Bug 12061 - /bin/date does not interpret TZ as expected
Summary: /bin/date does not interpret TZ as expected
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: sh-utils
Version: 6.0
Hardware: i386
OS: Linux
low
high
Target Milestone: ---
Assignee: bero
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-06-10 18:21 UTC by thoth
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-01-06 21:27:27 UTC
Embargoed:


Attachments (Terms of Use)

Description thoth 2000-06-10 18:21:21 UTC
The time zone as reported by date does not necessarily result in correct
behavior when used for the TZ envariable.

[thoth@maya thoth]$ date
Sat Jun 10 14:16:37 EDT 2000
[thoth@maya thoth]$ date +%Z
EDT
[thoth@maya thoth]$ TZ=EDT date
Sat Jun 10 18:16:47 EDT 2000
[thoth@maya thoth]$ TZ=Z date
Sat Jun 10 18:16:58  2000


What is the TZ for EDT anyway?

Comment 1 Jeff Johnson 2001-01-06 19:20:35 UTC
This is expected behavior, unknown time zones (like TZ=Z above) use either UTC
or
the native system time w/o timezone modification. Here's what I see on a machine
that keeps time
in UTC, but is in timezone EST:

bash$ date
Sat Jan  6 14:23:03 EST 2001
bash$ TZ=yadda_yadda date
Sat Jan  6 19:23:06 yadda_yadda 2001
bash$ TZ=UTC date
Sat Jan  6 19:23:19 UTC 2001
bash$ TZ=Z date
Sat Jan  6 19:23:28  2001


Comment 2 thoth 2001-01-06 20:28:41 UTC
What is the TZ for EDT anyway?

Comment 3 Jeff Johnson 2001-01-06 21:12:08 UTC
Eastern Daylight Time, GMT-4, same as New York City.

Comment 4 thoth 2001-01-06 21:24:53 UTC
[hammor@comstar3 hammor]$ date
Sat Jan  6 21:28:11 GMT 2001
[hammor@comstar3 hammor]$ TZ=Eastern date
Sat Jan  6 21:28:20 Eastern 2001
[hammor@comstar3 hammor]$ TZ=GMT-4 date
Sun Jan  7 01:28:26 GMT 2001

Please provide sample command line to output the date in Eastern on a machine
with a different /etc/localtime .  Please provide documentation pointers to
derive the proper values for the TZ environment variable for other time zones.

  Consider placing this documentation (or a reference to it) in the manual page
for the date command.


Comment 5 thoth 2001-01-06 21:27:24 UTC
Is there any way to get the date command to print out the proper value for the
TZ environment variable?


Comment 6 Jeff Johnson 2001-01-06 21:46:09 UTC
TZ is perfectly documented in "info libc", search for TZ.

There is no way that date can print out "proper" settings, as the problem is
equivalent
to defing "proper".


Note You need to log in before you can comment on or make changes to this bug.