aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-07 09:48:37 +0200
committerMattias Andrée <maandree@kth.se>2016-07-07 09:48:37 +0200
commitc5223db9a1569f006e69fceb966a5b7098db7504 (patch)
tree9646e1bd75005e5a63d588248525a42b30419679 /src
parentAdd amateur astronomical twilight (diff)
downloadlibred-c5223db9a1569f006e69fceb966a5b7098db7504.tar.gz
libred-c5223db9a1569f006e69fceb966a5b7098db7504.tar.bz2
libred-c5223db9a1569f006e69fceb966a5b7098db7504.tar.xz
Add daytime and nighttime test
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/libred.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libred.h b/src/libred.h
index 0bccd84..81066a3 100644
--- a/src/libred.h
+++ b/src/libred.h
@@ -87,10 +87,26 @@
* Test whether it is amateur astronomical twilight.
*
* @param ELEV:double The current elevation.
- * @return 1 if is astronomical twilight, 0 otherwise.
+ * @return 1 if is amatuer astronomical twilight, 0 otherwise.
*/
#define LIBRED_IS_AMATEUR_ASTRONOMICAL_TWILIGHT(ELEV) ((-18.0 <= (ELEV)) && ((ELEV) <= -15.0))
+/**
+ * Test whether it is nighttime.
+ *
+ * @param ELEV:double The current elevation.
+ * @return 1 if is nighttime, 0 otherwise.
+ */
+#define LIBRED_IS_NIGHTTIME(ELEV) ((ELEV) < -18.0)
+
+/**
+ * Test whether it is daytime.
+ *
+ * @param ELEV:double The current elevation.
+ * @return 1 if is daytime, 0 otherwise.
+ */
+#define LIBRED_IS_DAYTIME(ELEV) ((ELEV) > -32.0 / 60.0)
+
/**
* Calculates the Sun's elevation as apparent