* [Buildroot] date command
@ 2020-03-23 14:47 shy
2020-03-23 17:05 ` Peter Seiderer
0 siblings, 1 reply; 5+ messages in thread
From: shy @ 2020-03-23 14:47 UTC (permalink / raw)
To: buildroot
Hi:
I have a question and need your help.
The linux epoch time is 1970-01-01 00:00:00, I set the UTC time, but it has error with "date: cannot set date: Invalid argument".
I'm confused with it.
Best regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200323/3aa1a8d5/attachment.html>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] date command
2020-03-23 14:47 [Buildroot] date command shy
@ 2020-03-23 17:05 ` Peter Seiderer
2020-03-24 0:50 ` shy
0 siblings, 1 reply; 5+ messages in thread
From: Peter Seiderer @ 2020-03-23 17:05 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 23 Mar 2020 22:47:07 +0800 (CST), shy <mail_hysong@163.com> wrote:
> Hi:
>
>
> I have a question and need your help.
>
>
> The linux epoch time is 1970-01-01 00:00:00, I set the UTC time, but it has error with "date: cannot set date: Invalid argument".
> I'm confused with it.
Please show the exact commands (including options) your use...
Regards,
Peter
>
>
>
>
> Best regards!
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] date command
2020-03-23 17:05 ` Peter Seiderer
@ 2020-03-24 0:50 ` shy
2020-04-02 9:18 ` Peter Korsgaard
0 siblings, 1 reply; 5+ messages in thread
From: shy @ 2020-03-24 0:50 UTC (permalink / raw)
To: buildroot
Hi all:
I test in buildroot and ubuntu, it all can't set time "1970-01-01 00:00:00", there is error message "date: can't set date: Invalid argument".
I don't know why and how to solve the problem. It's UTC time and no timezone.
1. I use buildroot-2013.05, the busybox is in 1.21.1, the linux kernel is in version 4.4.39.
# date -s "1970-01-20 00:00:00"
Tue Jan 20 00:00:00 UTC 1970
# date -R
Tue, 20 Jan 1970 00:00:03 +0000
# date -s "1970-01-01 00:00:00"
date: can't set date: Invalid argument
Thu Jan 1 00:00:00 UTC 1970
2. I test in ubuntu version 14.04.1.
shy at ubuntu:/etc$ sudo date -s "2020-03-01 00:00:00"
Sun Mar 1 00:00:00 UTC 2020
shy at ubuntu:/etc$ date -R
Sun, 01 Mar 2020 00:00:03 +0000
shy at ubuntu:/etc$ sudo date -s "1970-01-01 00:00:00"
date: cannot set date: Invalid argument
Thu Jan 1 00:00:00 UTC 1970
shy at ubuntu:/etc$ uname -a
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
Best regards!
At 2020-03-24 00:05:49, "Peter Seiderer" <ps.report@gmx.net> wrote:
>Hello,
>
>On Mon, 23 Mar 2020 22:47:07 +0800 (CST), shy <mail_hysong@163.com> wrote:
>
>> Hi:
>>
>>
>> I have a question and need your help.
>>
>>
>> The linux epoch time is 1970-01-01 00:00:00, I set the UTC time, but it has error with "date: cannot set date: Invalid argument".
>> I'm confused with it.
>
>Please show the exact commands (including options) your use...
>
>Regards,
>Peter
>
>>
>>
>>
>>
>> Best regards!
>>
>>
>>
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200324/7df9940e/attachment.html>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] date command
2020-03-24 0:50 ` shy
@ 2020-04-02 9:18 ` Peter Korsgaard
[not found] ` <CAK8P3a1KX2Ln5zw=q0-eYLFz1vYL-UGOAA0N=SUFB3jCV1uDVA@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2020-04-02 9:18 UTC (permalink / raw)
To: buildroot
>>>>> "shy" == shy <mail_hysong@163.com> writes:
> Hi all:
> I test in buildroot and ubuntu, it all can't set time "1970-01-01 00:00:00", there is error message "date: can't set date: Invalid argument".
> I don't know why and how to solve the problem. It's UTC time and no timezone.
> 1. I use buildroot-2013.05, the busybox is in 1.21.1, the linux kernel is in version 4.4.39.
> # date -s "1970-01-20 00:00:00"
> Tue Jan 20 00:00:00 UTC 1970
> # date -R
> Tue, 20 Jan 1970 00:00:03 +0000
> # date -s "1970-01-01 00:00:00"
> date: can't set date: Invalid argument
> Thu Jan 1 00:00:00 UTC 1970
> 2. I test in ubuntu version 14.04.1.
> shy at ubuntu:/etc$ sudo date -s "2020-03-01 00:00:00"
> Sun Mar 1 00:00:00 UTC 2020
> shy at ubuntu:/etc$ date -R
> Sun, 01 Mar 2020 00:00:03 +0000
> shy at ubuntu:/etc$ sudo date -s "1970-01-01 00:00:00"
> date: cannot set date: Invalid argument
> Thu Jan 1 00:00:00 UTC 1970
> shy at ubuntu:/etc$ uname -a
> 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).
On an ancient 2.6.37 kernel it does work:
strace -e settimeofday date -s '1970-01-14 13:24'
settimeofday({tv_sec=1171440, tv_usec=0}, NULL) = 0
Wed Jan 14 13:24:00 UTC 1970
+++ exited with 0 +++
uname -r
2.6.37.6
Arnd, any ideas?
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] date command
[not found] ` <CAK8P3a1KX2Ln5zw=q0-eYLFz1vYL-UGOAA0N=SUFB3jCV1uDVA@mail.gmail.com>
@ 2020-04-02 11:33 ` Peter Korsgaard
0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2020-04-02 11:33 UTC (permalink / raw)
To: buildroot
>>>>> "Arnd" == Arnd Bergmann <arnd@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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-02 11:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 14:47 [Buildroot] date command shy
2020-03-23 17:05 ` Peter Seiderer
2020-03-24 0:50 ` shy
2020-04-02 9:18 ` Peter Korsgaard
[not found] ` <CAK8P3a1KX2Ln5zw=q0-eYLFz1vYL-UGOAA0N=SUFB3jCV1uDVA@mail.gmail.com>
2020-04-02 11:33 ` Peter Korsgaard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.