[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils don't accept time_t value
From: |
Eric Blake |
Subject: |
Re: coreutils don't accept time_t value |
Date: |
Thu, 04 May 2006 06:40:28 -0600 |
User-agent: |
Thunderbird 1.5.0.2 (Windows/20060308) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Please keep replies on the list, so that others may see the resolution if
they encounter the same issue.
According to Volker Kuhlmann on 5/4/2006 1:01 AM:
> Eric,
>
>> # local time zone used
>> date -d '1970-01-01 UTC 946684800 seconds' +"%Y-%m-%d %T %z"
>> 1999-12-31 19:00:00 -0500
>
> I did poke around the info docs but didn't see that. Splendid, works
> with the old version too.
>
>> date -d @946684800
>> Fri Dec 31 17:00:00 MST 1999
>
> Very useful, but makes the script dependend on the new version.
Also, not documented very prominently. See proposed patch:
>
>> 5.3.0 was an unstable release. Consider upgrading to the
>> latest stable release, 5.94.
>
> That will happen with the next distro upgrade, to whatever version
> distro then ships.
>
> Thanks much for your help,
>
> Volker
>
doc/ChangeLog
2006-05-04 Eric Blake <address@hidden>
* coreutils.texi (Examples of date): Give example of @seconds.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEWfY884KuGfSFAYARAkzkAJ99jxcZhCak0eho90MnWhcH/GDYzwCfdjO5
MaWhl/OiUdxXgWj2ubP9a1Q=
=hppU
-----END PGP SIGNATURE-----
Index: doc/coreutils.texi
===================================================================
RCS file: /sources/coreutils/coreutils/doc/coreutils.texi,v
retrieving revision 1.326
diff -u -p -r1.326 coreutils.texi
--- doc/coreutils.texi 23 Apr 2006 21:46:54 -0000 1.326
+++ doc/coreutils.texi 4 May 2006 12:36:15 -0000
@@ -12496,6 +12496,14 @@ date -d '1970-01-01 UTC 946684800 second
1999-12-31 19:00:00 -0500
@end smallexample
+Or if you do not mind depending on the @samp{@@} feature present since
+coreutils 5.3.0, you could shorten this to:
+
address@hidden
+date -d @@946684800 +"%F %T %z"
+1999-12-31 19:00:00 -0500
address@hidden smallexample
+
Often it is better to output UTC-relative date and time:
@smallexample