From 495072b36665fa50d31d2e1bdb96ad4e51f94d88 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 16 Dec 2019 12:04:28 +0100 Subject: [PATCH] . --- .idea/workspace.xml | 29 +++++++++++++++++------------ scripts/backyard.php | 5 +++++ scripts/lib/weatherstation.php | 10 ++++++---- 3 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 scripts/backyard.php diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9d9c4a6..e07c80a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,6 +2,7 @@ + @@ -768,14 +769,7 @@ - - - - 1565944175034 - 1566128716085 @@ -1113,7 +1107,14 @@ - @@ -1173,11 +1174,15 @@ - - + + - + + + + + diff --git a/scripts/backyard.php b/scripts/backyard.php new file mode 100644 index 0000000..7879a0b --- /dev/null +++ b/scripts/backyard.php @@ -0,0 +1,5 @@ +getTimestamp(); + $offset = $time->getOffset() / 3600; - $sunrise = date_sunrise($time->getTimestamp(), SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $time->getOffset() / 3600); - $sunset = date_sunset($time->getTimestamp(), SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $time->getOffset() / 3600); + $sunrise = date_sunrise($timestamp, SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $offset); + $sunset = date_sunset($timestamp, SUNFUNCS_RET_TIMESTAMP, LATITUDE, LONGITUDE, 90, $offset); - if ($time > $sunset && $sunrise < $sunset) { + if ($timestamp > $sunset && $sunrise < $sunset) { $sunrise += 3600 * 24; } - if ($time < $sunrise || $time > $sunset) { + if ($timestamp < $sunrise || $timestamp > $sunset) { return false; } return true; -- 2.39.5