-->
Page 1 of 2

Accurate time on an ESP8266

PostPosted: Tue Dec 26, 2017 8:01 am
by lotus49
Is there any way to get accurate time on an ESP8266. By accurate, I mean correct to < 0.1 seconds.

The only obvious way to do this is using NTP. I tried using the ntp_client library written by Michael Margolis and using configtime() but both these approaches result in a time about two seconds slow.

Keeping the time is no issue but I cannot set it sufficiently accurately.

Re: Accurate time on an ESP8266

PostPosted: Tue Dec 26, 2017 9:03 am
by rudy
There has been an addition two days ago that may help. uSeconds has been included in the settimeofday() function. I don't know how this will affect getting a more accurate time but it is encouraging.

https://github.com/esp8266/Arduino/pull/4001

See the bottom of https://github.com/esp8266/Arduino/issues/1679

https://github.com/esp8266/Arduino/tree ... NTP-TZ-DST

Re: Accurate time on an ESP8266

PostPosted: Tue Dec 26, 2017 11:03 am
by schufti
Afaik it is only a sntp client, so no subsecond or transport delay compensation.

Re: Accurate time on an ESP8266

PostPosted: Tue Dec 26, 2017 11:52 am
by rudy
I'm hoping someone will take it further.