[PATCH v2] ntpd: make NTP client and server Y2036/2038-ready

Miroslav Lichvar mlichvar at redhat.com
Fri Sep 16 13:35:06 UTC 2022


On Fri, Sep 16, 2022 at 03:06:36PM +0200, Miroslav Lichvar wrote:
> @@ -554,7 +554,7 @@ gettime1900d(void)
>  static void
>  d_to_tv(struct timeval *tv, double d)
>  {
> -	tv->tv_sec = (long)d;
> +	tv->tv_sec = (time_t)d;
>  	tv->tv_usec = (d - tv->tv_sec) * 1000000;

I suspect this part can be undefined behavior if time_t is 32-bit and
the client attempts to step after 2038. Do you want this case to be
handled, maybe with an error message logged?

-- 
Miroslav Lichvar



More information about the busybox mailing list