bug-coreutils
[Top][All Lists]
Advanced

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

Re: date bug


From: Eric Blake
Subject: Re: date bug
Date: Wed, 23 Apr 2008 22:01:55 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Aganan, Nicholas on 4/23/2008 9:22 AM:
|
|    VERSION:  6.4

You might want to consider upgrading; the latest stable version is 6.11.

| root @ surplus# date 033100002008
|
| Mon Mar 31 00:00:00 EDT 2008
|
|
|
| [/usr/local/bin]
|
| root @ surplus# /usr/local/bin/date -d 'last month' '+%b'
|
| Mar
| <<<< BUG, should be Feb

Rather than changing your system clock, you can combine dates to test this
in one invocation:

$ date -d 'Mar 28, 2008 last month' +%b
Feb

Your example is not a bug.  'last month' is documented to be equivalent to
'alter only the month field, then renormalize'.  Starting from 'Mar 31'
and altering the month field yields 'Feb 31', but since that is not a read
date, the renormalization process settles on Mar 2 (this year, and Mar 3
on other years).

There are at least three viable means of handling this ambiguity - error
out if altering the month gives an ambiguous date, renormalizing, or
truncating; obviously, the method you wanted was not the method that
coreutils chose, but you can't call it a bug since it was ambiguous in the
first place.  No matter which way we pick, someone will complain that we
picked wrong.  The manual also suggests using unambiguous dates when
trying to switch just months, as in "date -d 'Mar 15, 2008 last month' +%b".

This is also an issue with ambiguous times that fall on daylight savings
boundaries.

|
| The information transmitted is intended only for the person or entity

It is considered bad netiquette to post to publicly archived mailing lists
with such disclaimers, as they are unenforceable.  Some people refuse to
respond on principle.  Consider using a different email account, such as a
free web-based one, or a news gateway such as gmane, for posting to lists.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgQBjMACgkQ84KuGfSFAYADlwCdEijUtnPO+NwoXtlkp9qBZhbg
zVkAn0VQjH4Dz6l25bl9Mo2ecDIWNWZZ
=AfF9
-----END PGP SIGNATURE-----




reply via email to

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