bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU date = BSD date ?!


From: Grant Bayley
Subject: GNU date = BSD date ?!
Date: Tue, 20 Nov 2001 17:12:50 +1100 (EST)

Hi again,

Another buglet.  With GNU date from sh-utils this time.

YellowDogLinux 2.1 as before.

man date and info date show the following:

DATE(1)                        FSF                        DATE(1)

NAME
       date - print or set the system date and time

SYNOPSIS
       date [OPTION]... [+FORMAT]
       date [OPTION] [MMDDhhmm[[CC]YY][.ss]]

with a --set option for time setting:

       -s, --set=STRING
              set time described by STRING

Now, the clock was wrong on my Blue and White G3 here (it dropped back to
Apple's mysterious 1956 date) so I tried setting it back:

Lets try 20th November at midday:

address@hidden ntp-4.1.71]# date --set=11201200
date: invalid date `11201200'

Now try adding the century:

address@hidden ntp-4.1.71]# date --set=112012002001
date: invalid date `112012002001'

Now lets forget what the manual page says and try a BSD-like date, of the
form CCYYMMDD

address@hidden ntp-4.1.71]# date --set=20010110
Wed Jan 10 00:00:00 EST 2001

Whoa - it works.  Something very amiss here.

Lets add 5pm time on the end:

address@hidden ntp-4.1.71]# date --set=200101101700
date: invalid date `200101101700'

Oops.  No workies again.

Separately, with BSD formatted time:

address@hidden ntp-4.1.71]# date --set=20011120
Tue Nov 20 00:00:00 EST 2001
address@hidden ntp-4.1.71]# date --set=1709
Tue Nov 20 17:09:00 EST 2001

Okay, it's now on the actual time it should be.

Just for reference, here's the relevent bit of the BSD manual page for the
date command:

DATE(1)                    OpenBSD Reference Manual                    DATE(1)

NAME
     date - display or set date and time

SYNOPSIS
     date [-d dst] [-r seconds] [-t minutes_west] [-nu] [+format]
          [[[[[[cc]yy]mm]dd]HH]MM[.SS]]

Grant

-------------------------------------------------------
Grant Bayley                         address@hidden
-IT Manager @ FNL Communications       (www.fnl.com.au)
-Admin @ AusMac Archive, Wiretapped.net, 2600 Australia
 www.ausmac.net   www.wiretapped.net   www.2600.org.au
-------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]