are the timestamps in the leap second table correct? #292
Replies: 2 comments 9 replies
-
Thinking about this more, aren't two timestamps needed for each leap second to do conversions from UTC to TAI and from TAI to UTC? (Or at least, adjust the conversion algorithm to be aware of this fact.) Namely, when going from UTC to TAI, the leap second table is queried given UTC time (not TAI): Lines 316 to 327 in c28151d But when going from TAI to UTC, the same exact leap second table is queried given TAI time: Lines 1928 to 1933 in c28151d If the leap second table is indeed just NTP timestamps, then I think the UTC to TAI conversion is correct, but the TAI to UTC conversion is not. |
Beta Was this translation helpful? Give feedback.
-
Concerning the first example of The fact that the date is printed incorrectly is an alarming bug: it should absolutely be printed correctly. From running a checks, the two second offset seems to be specific to printing a date that is within a second of the leap second, so I'm guessing it's related to #255 . P.S.: Thanks for your patience and interest in this library, and please keep the bug reports coming! It's motivating to see people be interested in this pretty niche work, and I'm sorry there are still some bugs. |
Beta Was this translation helpful? Give feedback.
-
I was reviewing this code today:
https://github.com/nyx-space/hifitime/blob/c28151dd94a28951342352802dd04e783e53db35/src/leap_seconds.rs
I noticed that the timestamp at which the leap second occurred is interpreted as TAI, but the timestamps in leap-seconds.list are recorded as NTP timestamps. NTP uses the same epoch as
hifitime
, but my understanding is that all NTP timestamps are equivalent to Unix timestamps minus2208988800
(the number of seconds between1900-01-01T00:00:00Z
and1970-01-01T00:00:00Z
). This seems to imply to me that NTP timestamps are therefore not equivalent to TAI timestamps. Maybe I'm missing something?I wonder if this is related to the behavior in this code snippet?
The assertion fails with the following output:
Namely, I expected at least two things different in the output:
instants in time.
23:59:60
and the second to parse to23:59:59
. Instead, they both parse to23:59:57
, which I cannot explain.(Please interpret this as a low confidence query on my part. I've done a fair bit of reading on this topic and I've found it very difficult to plant my feet firmly on solid ground.)
Beta Was this translation helpful? Give feedback.
All reactions