[Top][All Lists]

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

Re: DATE set broken

From: Bob Proulx
Subject: Re: DATE set broken
Date: Wed, 6 Nov 2002 19:24:29 -0700
User-agent: Mutt/1.4i

> Your date set feature is horribly broken and/or misleadingly documented. 

It could certainly be improved.  Please make suggestions for
improvements!  But I don't think it is really that bad.  Let's take a
look at it.

Here is from the man page.

      date [-u]
      date [-u] +format
      date [-u] [mmddhhmm[[cc]yy]]
      date [-a [-]sss[.fff]]

This is from the info page.

     date [OPTION]... [+FORMAT]
     date [-u|--utc|--universal] [ MMDDhhmm[[CC]YY][.ss] ]

What is misleading about either of those?

> Per your documentation, these should work (date [-u|--utc|--universal]
> [MMDDhhmm[[CC]YY][.ss]])
>       date -s 11061137 <enter>
>       date -s 110611372002 <enter>

No.  Where did it ever say that?  Try this instead.

        date 110611372002 <enter>

Which matches the line here in the documentation.

      date [-u] [mmddhhmm[[cc]yy]]

Month, day, hour, minute, year.  But the info page also shows the
optional seconds tacked onto the end too.  Hmm...

> What is your format???? 
>        date [OPTION]... [+FORMAT]
>        -s, --set=STRING
>               set time described by STRING
> The + sign causes an error. 

Yes.  The -s option takes a STRING.  It is a GNU extension which has
been added to the code to add more functionality.  Try this syntax.
The -s is needed to let the program know you are not using the classic
syntax but using the extended syntax.

        date -s "Wed Nov 6 11:37 2002" <enter>

But the +FORMATs are for printing dates.  Which means you are not
setting the clock when you are printing but rather displaying a time.
Normally you would not use any option other than the plus.

  date +%a

But if you want to display the date at a particular time you can do
that.  But you need the -d DATESTR option.  Again from the info page.

  `-d DATESTR'
       Display the time and date specified in DATESTR instead of the
       current time and date.  DATESTR can be in almost any common
       format.  It can contain month names, time zones, `am' and `pm',
       `yesterday', `ago', `next', etc.  *Note Date input formats::.

  date -d '1 week ago' +%B

> None of the % FORMAT options work

The +FORMAT options are for printing.  Back to the info page.

  Invoking `date' with no FORMAT argument is equivalent to invoking
  `date '+%a %b %e %H:%M:%S %Z %Y''.

Give this a try.

  date '+%a %b %e %H:%M:%S %Z %Y'
  Wed Nov  6 19:11:26 MST 2002

> Give an example. You appear to accept one format for reading, but not for
> setting. The 2 operations should be 100% reversible. Bad design and/or
> implementation. 

Please bring up the info page for date.  Then look in the section
marked "Examples of date".  There you will find many examples.
Perhaps you had not read the documentation?  Although only one example
of setting the system clock.  That is not something that very many
users ever need to do.  But there are lots of examples for printing
the date and time in various formats.

If you have a network connection I recommend setting the data using
ntpdate from a NTP server.  Then using ntpd to keep the clock up to
date all of the time.  It is a very lightweight protocol and works
much better than trying to set the date manually.  However, if you are
offline then manual setting is about the best you can do.

If you have improvements to the documentation they would be much
appreciated.  What would you say in the info documentation to improve
the understanding?


reply via email to

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