Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!st12a From: st12a@menudo.uh.edu (richard henderson~) Newsgroups: comp.os.msdos.programmer Subject: Re: Time Zones: A Plea for Standards? Message-ID: <1991Apr15.155026.20777@menudo.uh.edu> Date: 15 Apr 91 15:50:26 GMT References: <1991Apr15.200244.7775@cc.curtin.edu.au> Organization: University of Houston Lines: 60 In article <1991Apr15.200244.7775@cc.curtin.edu.au> nmurrayr@cc.curtin.edu.au (Ron Murray) writes: > > While it's nice to see that programmers are beginning to realise that there >IS life outside their own country / timezone, it would be nice if they could >find some way of specifying this timezone without using a TZ environment >variable. > Perhaps I should explain. My interests are fairly wide-ranging, and they >include astronomy and various messaging systems. It seems, however, that >every man and his dog gets the brilliant idea of specifying the user's >time zone with an environment variable called. for some reason, "TZ". Even >that wouldn't be quite so bad if they all wanted it in the same format, but >some programs seem to want a three-letter code (e.g. "WST"), some want this >code but with a displacement from UTC added (and barf if it happens to be >negative!), and some are even worse. The result is that I can't have more >than one of these programs on my system at the same time, or one or more of >them gets upset, or more likely insists that the local time is 4 am when the >sun is shining outside. There _is_ a standard format for the TZ environment variable out there. There has been one for unix systems since the early 80s (I think). Now why people think they hav eto re-invent their own is another story. Here is the "official" format for this variable taken from MINIX POSIX source: * Time zones (TZ) are given as strings of the form (spaces only for clarity) * * Std Offset [Dst [Offset] [,Startdate[/Time], Enddate[/Time]]] * * where: * Std and Dst three or more bytes that are the designation for the standard * (std) or summer (dst) time zone. Only std is required; if dst * is missing, then summer time doen not apply in this locale. * * Offset and Indicates the value one must add to the local time to arrive * Time at Coordinated Universal Time. The offset has the form * hh[:mm[:ss]] * The hours shall be required and may be a single digit. If no * offset follows dst, summer time is assumed to be one hour ahead * of standard time. If preceded by a "-", the time zone shall be * east of the Prime meridian; otherwise it shall be west. Default * DST offset will be 1 hour, default switch Time will be 02:00:00 * * date The format of the date shall be one of the following: * Jn Julian day (1 <= n <= 365) * leapdays are NOT counted, so March 1 is always day 60 * n Zero-based Julian day (0 <= n <= 365) * leapdays are counted, so March 1 is day 61 in leapyears * Mm.n.d The d-th day (0<=d<=6) of week n (1 <=n<=5) of month * m (1<=m<=12), where week 5 means 'the last d day in * month m' which may occur in either the fourth or * fifth week. Week 1 is the first week in which d'th * day occurs. Day zero is sunday. * * See for more explanations on the TZ definition the IEEE Std 1003.1-1988 * Posix Standard, paragraphs 8.1.1 "Extensions to Time Functions" on 142-143. -------- richard~ st12a@menudo.uh.edu richard@stat.tamu.edu