HP3000-L Archives

April 1998, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Michael D. Hensley" <[log in to unmask]>
Reply To:
Date:
Tue, 7 Apr 1998 12:06:58 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (43 lines)
In response to a posting about a job stream that automatically changes
EST5EST to EST5EDT in the spring and back in the fall, Shawn Gordon asked:

> I don't understand why you are changing the last 3 char of the TZ variable,
> I don't think anything actually cares what is there, it's informational only
> isn't it?

It does matter, but changing it is wrong.  The C date/time routines use the
TZ variable to decide what the UTC (formerly GMT) offset and the daylight
savings time adjustment should be.  The EST5EDT entry in TZTAB says "adjust
by 1 hour during daylight savings time".  During non-daylight-savings-time,
the local time is UTC+5 hours; during daylight-savings-time, the local time
is UTC+4 hours *automatically*.  There is *no need* to change this variable,
ever, after it has been set correctly.

How do the date/time routines "know" when it's daylight savings time?  Via
the rules in TZTAB.

So, why do you need to use :SETCLOCK to change your TIMEZONE?  Because the
MPE date/time routines (CLOCK, CALENDAR, etc.) don't know about daylight
savings time.  During non-daylight-savings time (Eastern Standard Time), you
should have TIMEZONE set to W5:00; during daylight savings time (Eastern
Daylight Time), you should have TIMEZONE set to W4:00.

At bootup, MPE takes the "hardware clock" time (set by CLKUTIL) and adds the
GMT-offset to it to set the "software clock".  When anyone on the system asks
for the current date/time (via the get_ticks_since_1970 routine), MPE returns
the current *local* date/time from the "software clock".  This works fine for
the CLOCK and CALENDAR intrinsics.

However, the C library routines (like time())use the gmtsecs function, which
is supposed to return the current UTC (aka GMT) time.  It does this by
calling get_ticks_since_1970 (like everybody else), then subtracting the
TIMEZONE value, then re-adding in whatever the TZ variable say to -- which
will be different during daylight savings time and non-daylight savings time
periods.

Hope this helps!
---
Michael D. Hensley       | mailto:[log in to unmask]
Allegro Consultants Inc. |
408/252-2330             | Visit scenic http://www.allegro.com

ATOM RSS1 RSS2