calaos / calaos_base

Calaos server
https://calaos.fr
GNU General Public License v3.0
160 stars 37 forks source link

Incorrect calculation of sunrise and sunset for the days the DST time is set or unset #141

Closed mifrey00 closed 6 years ago

mifrey00 commented 6 years ago

System: ▶ calaos-os-raspberrypi-v3.0-alpha6-0 on Raspberry Pi 1 B ▶ Wago_2.2/wago_881.pro on Wago 750-881

Since calaos_server calculates the sunrise and sunset every day at midnight, the calculation is not correct for the days the DST time is set or unset. For example, if on October 29th 2017 at 3:00, the clock time is changed from 3:00 to 2:00, the sunset and sunrise previously calculated at 0:00 have an error of +1 hour.

Sunset and sunrise are incorrect for October 29:

# journalctl -elu calaos-server
...
Oct 28 00:00:00 raspberrypi calaos_server[31372]: [INF] server (TimeRange.cpp:266) Horaire: Computing sunrise/sunset for date 28/10/2017
Oct 28 00:00:00 raspberrypi calaos_server[31372]: [INF] server (TimeRange.cpp:291) Horaire: sunrise is at 08:19 and sunset is at 18:21
...
Oct 29 00:00:00 raspberrypi calaos_server[31372]: [INF] server (TimeRange.cpp:266) Horaire: Computing sunrise/sunset for date 29/10/2017
Oct 29 00:00:00 raspberrypi calaos_server[31372]: [INF] server (TimeRange.cpp:291) Horaire: sunrise is at 08:21 and sunset is at 18:20
...

Sunset and sunrise are correct if calaos_server is restarted:

# systemctl restart calaos-server
# journalctl -elu calaos-server
...
Oct 29 08:49:02 raspberrypi calaos_server[3634]: [INF] server (TimeRange.cpp:266) Horaire: Computing sunrise/sunset for date 29/10/2017
Oct 29 08:49:02 raspberrypi calaos_server[3634]: [INF] server (TimeRange.cpp:291) Horaire: sunrise is at 07:21 and sunset is at 17:20
...