[ntp:questions] 2036 rollover problem

Miroslav Lichvar mlichvar at redhat.com
Tue Mar 16 13:18:47 UTC 2021


On Tue, Mar 16, 2021 at 03:20:13PM +0300, Евгений Никишин wrote:
> I am currently working on the Y2036 problem. My app receives the current
> time from an NTPv4 compatible server (ntpd). As far as I understand, the
> ntpd server response contains a timestamp in NTP Timestamp format (i.e. as a
> combination of Seconds and Fraction). I want to change it to NTP Date
> Format, but I don't understand if it is supported by the standard. Could you
> clarify whether or not there are any packet header parameters that allow
> querying the time in NTP Date Format (i.e. as a combination of Era Number,
> Era Offset and Fraction).

NTPv4 doesn't exchange the era number. It's a feature that was
proposed for NTPv5, but that's likely too far in the future to be
available.

In your client you can hardcode a minimum NTP timestamp (e.g. from the
build time) and add 2**32 seconds to any timestamp smaller than that.
That should work as long as you update/rebuild the application at least
once per ~136 years.

-- 
Miroslav Lichvar



More information about the questions mailing list