On Wednesday 16 September 2015 11:23:29 Ksenija Stanojević wrote:
> If i use unsigned long instead time64_t then I cannot use
> ktime_get_seconds? Should
> I then leave get_seconds or use some other function?
The answer is right here:
> > We know that a 32-bit number is enough to store a monotonic time value
> > (because we don't support systems don't get rebooted for 136 years),
> > but we should also remove the 'time_t' getting mentioned here.
So get_seconds() will overflow in y2106 because it uses 'real' time and
returns an 'unsigned long'. Storing the result in a signed 'time_t' makes
it overflow in y2038 because we lose one bit for the signed type.
As you mention, ktime_get_seconds() returns a 64-bit time64_t for
consistency with ktime_get_real_seconds(), but it is not a problem
to store the result in a 32-bit variable, signed or unsigned.
arnd
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038