[comp.sys.mac.programmer] Time ain't on my side

resnick@lees.cogsci.uiuc.edu (Pete Resnick) (08/02/90)

I am trying to write a program that will set the system clock. I
would like to check the time zone I am in and whether to use
daylight savings. The less prompting of the user, the better, so:

Is there any way to access the time zone from the "Map" cdev. It
says in the documentation (when was the last time any of you looked
in the Macintosh Utilties User's Guide, p, 124):

     "With Map, you can set the Current Location, which is
      stored in your Macintosh just like the time and date.
      You can call upon that location from application
      programs or from HyperCard."

How? I looked in the cdev using ResEdit at the both the CTY# and
MCFG resources, but the CTY# is just the list of cities and there
is nothing deciferable in MCFG. What gives?

Also, is there anything in System Software for determining daylight
savings rules? If not, does anyone know the official rules, or know
how to get them from the time gods in France, or wherever they may be?

pr
--
Pete Resnick             (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@kant.cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD

minow@mountn.dec.com (Martin Minow) (08/03/90)

In article <1990Aug2.003955.4443@ux1.cso.uiuc.edu>
resnick@lees.cogsci.uiuc.edu (Pete Resnick) writes:
>
>Is there any way to access the time zone from the "Map" cdev. It
>says in the documentation (when was the last time any of you looked
>in the Macintosh Utilties User's Guide, p, 124):

I wrote an article on this for MacTutor (September-ish 1989 -- it's in
a recent "Best of" collection.  You might also find the info in the
latest ScriptManager documentation (check the Sumex archives or apple.com
archives or bug a certified developer).  Essentially, the info the Map
CDEV uses is stored in the parameter RAM.  Time zone is stored as "seconds
offset from UTC (GMT)" in 24 bits.  I think the high byte is reserved for
a daylight savings time flag of some sort.

>
>Also, is there anything in System Software for determining daylight
>savings rules? If not, does anyone know the official rules, or know
>how to get them from the time gods in France, or wherever they may be?
>
Not that I know of.  There may be a collection of Daylight Savings Time rules
floating around the Unix source library part of Usenet: one of the
archive sites might have more info.  The rules are messy and very subject
to change.  In fact, in some instances (Arizona, for example), they are
so messy as to be useless.  (In Arizona, "government owned" land follows
daylight savings time rules, while non-government land does not.)

Martin Minow
minow@bolt.enet.dec.com