Using "date +%s" I can get the number of seconds since the epoch.
Fine.  I now want to convert it back to a date.  The manual states
that I can do so:

>      To convert such an unwieldy number of seconds back to a more
>      readable form, use a command like this:
> 
>           date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z"
>           2000-01-01 00:00:00 +0000

Reading this, I would expect that

        date; date -d "1970-01-01 `date +%s` sec"

would produce two equal lines (unless I run the commands just as the
clock ticks).  However, there is a 1-hour difference:

Fri Aug 16 15:34:52 MEST 2002
Fri Aug 16 14:34:52 MEST 2002

If I set TZ=GMT and re-run the commands, I get the expected result:

Fri Aug 16 13:35:28 GMT 2002
Fri Aug 16 13:35:28 GMT 2002

TZ was unset when I ran the first commands.

I have tested this under Linux 2.4.18pre1 using glibc-2.2.5, and under
Solaris 2.8.

Daylight savings time is currently in effect.  I'm 1 hour from UTC.

        /ceder


_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to