-->
Page 1 of 2

Daylight saving again... :(

PostPosted: Thu May 18, 2017 4:55 pm
by Joaquim Boavida
Hi,
I'm using the latest version (Alpha 69) and I cannot get the time.setup with daylight saving option enabled.
I'm in UCT (offset zero) but now we are in the "summer" time, so actually the time is plus 1 hour. Dayligt time saving is active.

The time zone works as expected, but the daylight option no.
Is the same thing is I use time.setup(0,0) or timesetup(0,1)
The same if I use custom timeservers (Ex: 1.europe.pool.ntp.org)

Resuming:
time.setup(0,1)
time.setup(0,1,"1.europe.pool.ntp.org")

none works :(
Also using the settings on the files and the time() function returns the time without the daylight saving

I have other clocks (wired, not WiFi) with other firmware that woks great.
Anyone has the same problem?
Thanks
Joaquim

Re: Daylight saving again... :(

PostPosted: Thu May 18, 2017 6:55 pm
by heckler
I don't believe that I have ever seen the DST part of time.setup(zone,dst) work correctly.
I just resort to manually changing the zone by +/- 1 when the time changes.

I have implemented a routine in a PIC microcontroller that does a calendar calculation each time the time() is retrieved from the esp module to check if DST is in effect or not.

see my project here http://www.picbasic.co.uk/forum/showthread.php?t=20965
if you want to see how I did it.

As I think about it though, what is/was the intended purpose of the dst value in the time.setup(zone,dst)??
It still requires a manual change when the time changes. Why not just adjust the zone and forget the dst value?

am I missing something?
regards
dwight

Re: Daylight saving again... :(

PostPosted: Thu May 18, 2017 8:28 pm
by jimg
The only way to get dst info is using the daytime protocol. Just connect to time.nist.gov on port 13 using tcp or udp and it will return a string with dst info. If you're lucky.

Re: Daylight saving again... :(

PostPosted: Fri May 19, 2017 12:57 am
by Joaquim Boavida
The purpose of DST parameter in the function (I think) is to do it automatically.
The clocks will be used in a factory and they are supposed to be completely independent and self contained regarding to the time and accuracy...
They will required intervention only if the SSID or password changes.
Like I said I use Bascom for my non WiFi microncontrollers and it is working perfectly...
Probably I have to replicate the function that calculates the DST on esp8266 basic. But its supposed to be internal, because we add seconds, not hours..