[Buildroot] date command
Peter Korsgaard
peter at korsgaard.com
Thu Apr 2 11:33:01 UTC 2020
>>>>> "Arnd" == Arnd Bergmann <arnd at arndb.de> writes:
Hi,
>> > Linux ubuntu 4.4.0-142-generic #168~14.04.1-Ubuntu SMP Sat Jan 19 11:26:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
>>
>> This looks to be a kernel regression, presumably introduced by the year
>> 2038 work.
>>
>> Specifically, it seems to reject settimeofday with a tv_sec value less
>> than 1171500:
>>
>> # strace -e settimeofday date -s '1970-01-14 13:24'
>> settimeofday({tv_sec=1171440, tv_usec=0}, NULL) = -1 EINVAL (Invalid argument)
>> date: can't set date: Invalid argument
>>
>> # strace -e settimeofday date -s '1970-01-14 13:25'
>> settimeofday({tv_sec=1171500, tv_usec=0}, NULL) = 0
>> Wed Jan 14 13:25:00 UTC 1970
>>
>> (here on 5.4.18).
> I think this is a result of commit e1d7ba873555 ("time: Always make sure
> wall_to_monotonic isn't positive") that enforces CLOCK_REALTIME to return a
> number greater than CLOCK_MONOTONIC, meaning you cannot set the current
> time to anything less than the number of seconds since booting the system.
> This has been the case since linux-4.3, and is unrelated to the y2038 work.
Ahh yes, thanks - And sorry for pointing fingers in the wrong
direction. I did see the check, but didn't connect the dots.
--
Bye, Peter Korsgaard
More information about the buildroot
mailing list