Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 1997 11:38:39 +0930 (CST)
From:      Greg Lehey <grog@lemis.com>
To:        brian@awfulhak.org (Brian Somers)
Cc:        hackers@freebsd.org (FreeBSD Hackers)
Subject:   Re: date(1)
Message-ID:  <199708010208.LAA08172@freebie.lemis.com>
In-Reply-To: <199708010131.CAA21758@awfulhak.org> from Brian Somers at "Aug 1, 97 02:31:14 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Brian Somers writes:
>> On Wed, 30 Jul 1997 grog@FreeBSD.ORG wrote:
>>
>>>>>>>>>> yy[mm[dd[hh]]]]mm[.ss]]
>>
>> At risk of missing the obvious, why can't the above simply be
>> extended to
>>
>>> cc[yy[mm[dd[hh]]]]]mm[.ss]]
>
> Yep.  As I suggested.
>
>> ?  This format strikes me as being right since any usually, if the
>> date is off by a large amount (eg. centuries), the year, month, day,
>> hour, and minute will also be off.  However, the date being off by a
>> minute or two, while the hour, day, month, year, and century are
>> correct is not unusual.
>>
>> This seems to avoid the below monstrosities.
>>
>>>>> 	[[[cc]yy[mm[dd[hh]]]]mm[.ss]]
>>>>>> cc[yy[mm[dd[hh]]]]]mm[.ss]]
>>
>> The first is hopelessly ambigious and the 2nd is hopelessly
>> annoying.
>
> The first is just wrong, and the second is a mis-quote.  I originally
> said:
>
>> More like:
>>
>>>> cc[yy[mm[dd[hh]]]]]mm[.ss]]
>>
>> (you can't have the century without the year).

I think this confusion is making my point: the syntax is too
complicated.  I understand the [...] to mean optional parts.  In this
case, we have two unbalanced ]s:

cc[yy[mm[dd[hh]]]]]mm[.ss]]
                  ^       ^
                  |       |

Ignoring this problem, this syntax can be expanded to:

cc[yy[mm[dd]]]mm[.ss]
cc[yy[mm]]mm[.ss]
cc[yy]mm[.ss]
ccmm[.ss]
cc[yy[mm[dd]]]mm
cc[yy[mm]]mm
cc[yy]mm
ccmm

So 'date 2001' must mean "set the date to century 20, year undefined,
month, day, and hour undefined, minute 1.

Most newcomers to UNIX hate date(1) because the date entry format is
already too cryptic.  This would just make it worse.  There are some
other alternatives for date entry--tar uses one, for example, though
it may be GNU code.  Why not base an implementation on one of those?

Greg




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708010208.LAA08172>