-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to [EMAIL PROTECTED] on 7/11/2007 4:52 AM: > [EMAIL PROTECTED] ~]# date --version > date (coreutils) 5.2.1
This is several years out of date. The latest stable version of coreutils is 6.9; I suggest upgrading, and seeing if the problem remains in newer releases. It may also be dependent on what version of bison compiled getdate.y, since we are dealing with an ambiguous parse. But for what its worth, I see the following on a cygwin host, with a timezone -7 hours from UTC: $ date --version | head -n1 date (GNU coreutils) 6.9 $ date -d '1970/01/01 01:00:00 + 0 seconds' '+%F %T' 1969-12-31 18:00:01 $ date -d '1970/01/01 01:00:00' '+%F %T' 1970-01-01 01:00:00 The addition of '+ 0 seconds' changes the time by 7 hours and 1 second. Hmm, that looks like the '+0' is being interpreted as a timezone specifier, which then enables timezone correction (treating my entered time with zone +0000 but displaying it with zone -0700), as well as taking 'seconds' as a directive to add one second. In other words, the date engine is parsing: (1970/01/01 01:00:00 + 0) seconds instead of (1970/01/01 01:00:00) (+ 0 seconds) An unambiguous approach is to put the relative information where it can't be confused with a timezone: $ date -d '+0 seconds 1970/01/01 01:00:00' '+%F %T' 1970-01-01 01:00:00 $ date -d '+60 seconds 1970/01/01 01:00:00' '+%F %T' 1970-01-01 01:01:00 $ date -d '+61 seconds 1970/01/01 01:00:00' '+%F %T' 1970-01-01 01:01:01 And if you really want seconds since the epoch (where 1970/01/01 01:00:00 is 3600 seconds), use the @ notation: $ date -u -d @3600 '+%F %T' 1970-01-01 01:00:00 - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGlM6w84KuGfSFAYARAmERAJoDs9Gqadl/k8ma1Vk+xYJprnYORACfV9To 4WwGFHtJnMtoN+ioP4kiiHQ= =o12r -----END PGP SIGNATURE----- _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
