General area when it fits no where else

Moderator: Mmiscool

User avatar
By jimg
#64412 How precisely do you want to know the time? The internal oscillator is good to a few seconds a day, so you should only need to connect one or two times a day to update to the correct time. After a few times, you can calculate pretty closely how many ticks you need to add per time period and can update on your own, thus needing fewer actual connections to a time server. Then you're good for several days without connecting. (Unless the unit is subjected to random large swings in temperature which affects the ticker.)

I myself am struggling with daylight saving time. You can guess based on what the current rules are, but I wouldn't want to write a program that relies on that. Who's to say that next year some eco-congressman won't get a bill passed changing the start of DST to the third Wednesday in february at 3:30 am so as to better save the dolphins and protect the ozone layer? I don't plan to write code vulnerable to such whims.

The only official online source giving an indicator that you are on dst is the daytime protocol. Unfortunately, I have been unable to get it to work using udp. I've used zbasic to write a program to get it using tcp, but tcp is not working currently in espbasic.
User avatar
By Boxey
#64439 I was under the impression that the ESP only has an internal clock ticking away inside (which it would have to have to be able to process data, run the timers, read the memory, run through the lines of code, etc), but no actual "time" or "date" clock inside.

Before (GGM) Geek God Mike added the Time and Timesetup functions, The only way to get an accurate time and date clock was to use WGET and drag the data in from one of the many time server pages on the net and disect it. (I believe this is what the Time function now does behind the scenes).

However, the documentation shows that your able to set the timezone and daylight saving (with timesetup), but this appears to have no effect. (There is some sort of work around code http://www.esp8266.com/viewtopic.php?f=38&t=14165&start=8 ...but this seems to defeat the object of having "timesetup", so I imagine there maybe a bug somewhere in the code, which maybe Mike will look into when he gets the time (no pun intended :P )