Alan,
I made some code to set an offset in minutes to offset $dayornight tag for Day or Night
For anybody else reading this thread. If you do not want this offset feature, no need to install this code.
This code overrides the $dayornight tag with a new offset $dayornight based on adjusted sunrise / sunset times
Put this code at the bottom of your testtags.txt template in your WD webfiles folder
// set offset in minutes to offset $dayornight tag for Day or Night
$day_offset = '-60'; // $day_offset = '-30'; this subtracts 30 minutes before switching from Night to Day
$night_offset = '+60'; // $night_offset = '+30'; this adds 30 minutes before switching from Day to Night
$t_now = date('Hi', strtotime("$time"));
$t_sr = date('Hi', strtotime("$sunrise $day_offset minutes"));
$t_ss = date('Hi', strtotime("$sunset $night_offset minutes"));
if( $t_now > $t_ss || $t_now < $t_sr ) {
$dayornight = 'Night';
}
else {
$dayornight = 'Day';
}
Note: you may need to adjust the $day_offset and $night_offset settings to your liking.
Not all web cams are the same as far as how good they show low light levels, so therefore no one offset setting will fit all.