-->
Page 1 of 2

Time...

PostPosted: Wed Feb 16, 2022 9:32 am
by Inq720
... as received by millis(), micros(), system_get_time(), et al... Does it get affected by WiFi pauses?

I've gone to great lengths to try and get a web server to be perfectly stable. Considering, at the lowest level, it depends on lwIP, TCP, IP, link layer, ESP hardware, router and airwave congestion, perfect stability is impossible. A simple collision on the WiFi airwaves can loose a packet that requires a resend which bubbles up to the top in the form of a momentary pause in the transfer of data.

I would assume that the time base is tied to something immune to pausing... like a crystal. However, there are a lot of steps between the crystal and code getting a return u32 millis(). I wanted to check with the Advanced experts on this forum to see if my assumption is correct.

Thanks,

Re: Time...

PostPosted: Wed Feb 16, 2022 4:54 pm
by davydnorris
Yes, time is based on the internal system clock and uses NTP - the system clock is pretty solid if you are looking to measure time differences, but if you are looking to measure the actual internet time as UTP then remember that NTP itself is only accurate to a second or so.

Re: Time...

PostPosted: Thu Mar 03, 2022 6:44 am
by Inq720
davydnorris wrote:Yes, time is based on the internal system clock and uses NTP - the system clock is pretty solid if you are looking to measure time differences, but if you are looking to measure the actual internet time as UTP then remember that NTP itself is only accurate to a second or so.


Thank you for responding. I don't think I explained my questions well enough... I'm not concerned about the aspects of getting a real-world based time. I'm merely talking about time relative to boot-up... millis(), micros(), system_get_time().

My questions is about the how system_get_time() works. Since we can't see Espressif's implementation in software, I'm looking for the Advanced user's opinions (or knowledge) about how this type of thing is achieved. I would assume/expect it to be directly tied to some counter that gets updated by a crystal at the very lowest level. But...

When I push the ESP8266 very hard sending/receiving data over WiFi, I note unexplained pauses. Its probably just TCP contention on my network causing a NAK and resend. If the time system_get_time() is tied where I think it is... it is immune to this pause. But... I just wanted to check with people that may know far more about the hardware / Espressif core software implementation than I.

Thanks.

Re: Time...

PostPosted: Thu Mar 03, 2022 4:30 pm
by davydnorris
It works off the internal clock, which also drives the Wifi so no it's not affected by any processing