Post links and attach files for documentation here, also chat about these docs freely

User avatar
By ectoplasma
#47811 Hey everyone,

If anyone here is wondering how well an arduino or esp8266 keeps track of time on its own (without using a real time clock unit), I tested it for you:

http://www.instructables.com/id/TESTED- ... -WITHOUT-/

Spoiler: only about one second off every day.

Any suggestions on improving the code would be more than welcome. I just read that millis() resets every 50 days, so I am gonna have to write some code to deal with that.
User avatar
By lotus49
#48778 That's interesting. I am building a time-based one time password activated device and keeping reasonably accurate time is a core requirement. I had been wondering whether a hardware RTC would be necessary but given that I can access NTP servers from the ESP8266, I may not need one if the clock is reasonably accurate.

Thank you.
User avatar
By eriksl
#48781 BTW my experience is that ntp isn't implemented correctly (at least in the newest SDK versions, don't know about older ones). The time is only fetched once and after that it's never adjusted. And believe me, that's necessary, the built-in RTC clock runs about 1 hour fast on 24 hours.

So I worked around that by every ten minutes stopping ntp and starting it again, and then you will get periodic adjustment.