ntpd: make NTP client and server Y2036/2038-ready

The 32-bit integer part of the NTP timestamp overflows in year 2036,
which starts the second NTP era.

Modify the timestamp conversion to shift values between 1900-1970 (in
the first era) to the second era to enable the client to measure its
offset correctly until year 2106 (assuming 64-bit time_t).

Also update the conversion from double used when stepping the clock to
work with 64-bit time_t after reaching the maximum 32-bit value in 2038
and the server conversion to work correctly in the next NTP era.

function                                             old     new   delta
lfp_to_d                                              51      64     +13
step_time                                            326     332      +6
.rodata                                           105260  105264      +4
d_to_lfp                                             100      86     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 23/-14)              Total: 9 bytes

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
1 file changed