[comp.sys.next] Daylight savings time

madler@piglet.caltech.edu (Mark Adler) (10/30/90)

I went around to all my clocks to change to standard time and what do you
know, my NeXT had already changed!  One of the advantages of having a
Unix machine, I suppose.

I've always wondered, however, why it is that my NeXT and my PC, and most
any other multi-thousand dollar machine can't keep time better than your
average $5 digital watch?  My NeXT loses about a minuteweek, and my PC
gains about a minute every two weeks.  My Casio digital watch loses about
a minute every five months!  And it's not just that watch.

Mark Adler
madlerpiglet.caltech.edu

madler@piglet.caltech.edu (Mark Adler) (10/30/90)

Someone asked me what algorithm the NeXT uses to determine when to
change from or to daylight savings time.  I sent him a "dunno" reply,
but since found the answer: it doesn't have an algorithm.  There is
a file (/etc/zoneinfo/localtime) that contains a list of local time
changes.  For Pacific time, the changes cover from 1918 to 2037.

One can even see a little bit of history in the data.  Daylight Savings
Time was tried in 1918 and 1919 and then apparently dropped.  Then daylight
savings time (actually called PWT instead of PDT) was in effect continuously
from Feb 1942 through Sep 1945.  Guess what the "W" stands for.  Then,
daylight savings time was instituted on a regular basis starting in 1967.

There does appear to be an algorithm extractable from the data (at least
from 1967 on)---change to PDT on the first Sunday of April at 3 a.m., and
change to PST on the last Sunday of October at 1 a.m.  This appears to
apply to Mountain, Central, Eastern, and Yukon as well.  Arizona, Hawaii,
and East Indiana (?) don't have daylight savings time.

I could mention that Canada changes instead on Saturday night at 10 p.m., 
or that Singapore doesn't change at all, but I won't.

Mark Adler
madler@piglet.caltech.edu

cnh5730@calvin.tamu.edu (Chuck Herrick) (10/31/90)

In article <1990Oct30.070713.14635@nntp-server.caltech.edu> madler@piglet.caltech.edu (Mark Adler) writes:
)savings time (actually called PWT instead of PDT) was in effect continuously
)from Feb 1942 through Sep 1945.  Guess what the "W" stands for.  Then,

Weenie? as in the farm lobby.

vehaag@crocus.uwaterloo.ca (Viktor Haag) (10/31/90)

In article <1990Oct30.070713.14635@nntp-server.caltech.edu> madler@piglet.caltech.edu (Mark Adler) writes:
>
>I could mention that Canada changes instead on Saturday night at 10 p.m., 
>or that Singapore doesn't change at all, but I won't.

And New Zealanders change twice a year, and they have their own special
Kiwi Time!

Just as a curiosity, how does one set the particular system, depending on what
time zone you work in?

What happens if you don't have a file that corresponds to your time-zone (the
kiwi example leaped to mind)?

vik (a NeXT neophyte)

--
	"We murder to dissect"			
		Wordsworth

madler@piglet.caltech.edu (Mark Adler) (11/01/90)

vik (a NeXT neophyte) points out:
>> And New Zealanders change twice a year, and they have their own special
>> Kiwi Time!

They even have their own special localtime file: /etc/zoneinfo/NZ
Kiwi's have had DST since 1974 and change the Saturday before the last
Sunday in October from 6 pm to 7 pm (to DST) and change the Saturday
before the first Sunday in March from 7 pm to 6 pm (from DST).  (I bet
you were all dying to know that.)  Note that these down-under types
have the seasons shifted by pi, so they just changed to DST.

>> Just as a curiosity, how does one set the particular system, depending
>> on what time zone you work in?

In Preferences click on the clock and then slide the map bar to see the
land-of-many-sheep and click on it.  Then pick "NZDT,NZST" on the button
list above the map.

>> What happens if you don't have a file that corresponds to your time-zone
>> (the kiwi example leaped to mind)?

I guess you'd have to make your own localtime file and put it in
/etc/zoneinfo.  The file format is documented in the man page tzfile(5).
However, it looks like a rather thorough job was done on having all the
time zones in /etc/zoneinfo.

Mark Adler (a NeXT phyte)
madler@piglet.caltech.edu

kloppen@gmdzi.gmd.de (Jelske Kloppenburg) (11/02/90)

vehaag@crocus.uwaterloo.ca (Viktor Haag) writes:

>...

>Just as a curiosity, how does one set the particular system, depending on what
>time zone you work in?

>...

I found out by trial and error (mostly error). The world map in Preferences
'knows' about time zones. If you klick on Europe, Preferences shows GMT+1
but does not know the daylight saving time rule.
If you look into the folder /etc/zoneinfo you see files GMT+n. GMT+1
contains some unprintables - mostly \0 - and 'GMT+0100'. Now there is
another file MET with the definition of the rules for DST in MET.
I copied MET to GMT+1 and now my Preferences knows my daylight saving time.

j.k.

  Jelske Kloppenburg, kloppen@gmdzi.gmd.de, (++49 2241) 14-2433
  German National Research Center for Computer Science (GMD)

cyliao@hardy.u.washington.edu (Chun-Yao Liao) (11/03/90)

In article <1990Oct29.192654.28687@nntp-server.caltech.edu> madler@piglet.caltech.edu (Mark Adler) writes:
>I went around to all my clocks to change to standard time and what do you
>know, my NeXT had already changed!  One of the advantages of having a
>Unix machine, I suppose.

	mmm.. how interesting... I think you are right 'cause I don't recall
	that I changed the time, and it is giving me the right reading :-)
>
>I've always wondered, however, why it is that my NeXT and my PC, and most
>any other multi-thousand dollar machine can't keep time better than your
>average $5 digital watch?  My NeXT loses about a minuteweek, and my PC
>gains about a minute every two weeks.  My Casio digital watch loses about
>a minute every five months!  And it's not just that watch.

funny, my casio watch gets faster a few seconds each month, but my NeXT is
2 minutes faster than my watch after almost 3 months! While many people 
complained that the clock slowed down, mine speed up!



cyliao@wam.umd.edu     		o NeXT :  I put main frame power on two chips.
      @epsl.umd.edu		o people: We put main flame power on two guys.
      @bagend.eng.umd.edu       o ::::::::::::::::::::::::::::::::::::::::::::
 xxxxx@xxxxx.xxx.xxx (reserved)	o RC + Apple // + Classic Music + NeXT = cyliao