jellewie / Arduino-Smart-light

A smart 3D printed light clock/lamp, that includes, but is not limited to; WIFI and manual control, Clock mode, multiple animations, and transitions.
Other
7 stars 1 forks source link

Daylight saving time not auto applied #42

Closed jellewie closed 1 year ago

jellewie commented 3 years ago

Daylight saving time is not automatically applied and removed, although the offset time (3600) has been set.

The default ESP32 time library is used (if I'm not wrong) so who doesn't it do this? is there a config error (do we need to set dates, or enable it?) or is this really a bug?

https://github.com/jellewie/Arduino-Smart-light/blob/4e2bdca7e8c97ab514b5bf7a0a8bff4dde339aa7/Arduino/Clock.h#L112 https://www.cplusplus.com/reference/ctime/tm/ notes something about a 'tm_isdst' being set? https://www.cplusplus.com/reference/ctime/localtime/

jellewie commented 3 years ago

Should be fixed, but is untested, but ATM the time is right

Date 2021-04-10 (DST enabled) daylightOffset_sec = 3600 Current time = 13:22 (Right)

when daylightOffset_sec changed to 0 (and synctime is called), the offset is removed (12:22) as should.

jellewie commented 1 year ago

So it seems that it does apply, but on the wrong date (like 1-2 weeks off)

jellewie commented 1 year ago

The date applied is the US date

jellewie commented 1 year ago

The Readme still must be updated to reflect the changes.

When updating it will see that's its invalid (either empty or its a number) and will change it to the default AMSTERDAM time. old values will be overwritten. The other value is skipped and marked as unused (Replaced with "")