[comp.sys.apollo] Fun with timezones

sahayman@iuvax.cs.indiana.edu (Steve Hayman) (07/14/89)

I have submitted this as an APR but thought others might be interested.

Indiana is on Eastern Standard Time year round, and I cannot seem to
use "tz" to set the timezone to "EST" without having it assume I also
want "EDT".   (Actually I can get it to work but the method is a hack,
see below.)  (If there's a better way, someone please let me know.)

An annotated listing of my attempts follow.  The idea is to use "tz" on
the machine "sjohnson" to set the timezone and offset, and then use
"rsh sjohnson date" to show what the date is in a brand new context.

First try - just use EST:

    # tz EST; rsh sjohnson date
    Fri Jul 14 00:39:09 EDT 1989		# no good, assumes you want EDT

Hmmm, maybe if we explicitly say what the offset of EST is, as if
we were defining a brand new zone:

    # tz EST -5:00; rsh sjohnson date
    Fri Jul 14 00:39:31 EDT 1989		# still assumes you want EDT

OK, maybe "EST" is in a table of existing time zones somewhere, no problem.
Let's try inventing a brand new time zone, "IST", Indiana Standard Time.

    # tz IST -5:00; rsh sjohnson date
    Fri Jul 14 00:39:50 IDT 1989	# Where the !@#@*() did "IDT" come from?

Hmm, this odd program must be looking up "?ST" in a table and assuming you
mean "?DT" when appropriate.  Let's try "IUT" instead of "IST":

    # tz IUT -5:00; rsh sjohnson date
    Thu Jul 13 23:40:04 IUT 1989

OK, if you give it an unexpected time zone, it seems to believe you.
Hmmmm ... What if we give it a zone longer than 3 characters?

    # tz Eastern -5:00; rsh sjohnson date
    Thu Jul 13 23:40:29 EAS 1989

Aha!  That does almost what we want but we'd like it to say "EST"
instead of "EAS", so let's fake it out and use "ESTx" instead of "EST":

    # tz ESTx -5:00; rsh sjohnson date
    Thu Jul 13 23:40:44 EST 1989

Success at last - new shells get the TZ and TZNAME variables we wanted
all along.

    # rsh sjohnson printenv
    ...
    TZ=EST5
    TZNAME=EST,



Ideally I'd like to see Apollo adopt the public domain time zone code
that many other manufacturers (e.g. Sun) use - this code by Arthur Olson
has been posted to the net in the past, and it allows you to define a file
giving the time zone rules for your location.  SunOS comes with a
special "East-Indiana" file which matches our needs exactly.  Sure is
easier than doing this kind of goofing around.

..Steve
-- 
Steve Hayman    Workstation Manager    Computer Science Department   Indiana U.
sahayman@iuvax.cs.indiana.edu                                   (812) 855-6984