adafruit / Adafruit_CircuitPython_NTP

Network Time Protocol (NTP) Helper for CircuitPython
MIT License
9 stars 18 forks source link

guard against invalid response #38

Closed tedder closed 1 month ago

tedder commented 1 month ago

Test to ensure response value is valid. Intermittent seconds=0 value have been seen.

fixes #35

tedder commented 1 month ago

I've only seen zero. Could do that if it's what you'd like.

tedder commented 1 month ago

This may get usurped by #39, which is totally fine.

tannewt commented 1 month ago

Do you want to update this since #39 is merged?

tedder commented 1 month ago

I don't know that the failure will be the same now that 39 is merged. It's probably these unpackings: https://github.com/adafruit/Adafruit_CircuitPython_NTP/pull/39/files#diff-2476a2f533d178076a598d69ec1dcb7c111cb00afe72382d2d68dcab2d9d0c8cR103

but I'm not confident on what's going to happen. So this can be closed.

jepler commented 1 month ago

I know this is closed, but I just wanted to note that the seconds value of 0 is special in NTP:

Timestamps are unsigned values, and operations on them produce a result in the same or adjacent eras. Era 0 includes dates from the prime epoch to some time in 2036, when the timestamp field wraps around and the base date for era 1 is established. In either format, a value of zero is a special case representing unknown or unsynchronized time.