hello *,

By now nearly the whole civilized world will have found it necessary to
complicate people's lives by changing the time. This summertime, often
called daylight saving time (DST) will last for a couple of months and
then _again_ the time is changed. Are you fed up with changing the time
of your computer too? Here is the way to do it better :-).

Posix defines in its 1003.1 a TZ environment variable which indicates
when you DST starts and ends and a (char *)tzname[2]. I implemented 
these in the 1.5.10 Minix lib/ansi/ctime.c for the functions involved, 
i.e. ctime(), localtime(), mktime() and tzset(). In the source I 
include a complete desciption of what the TZ looks like according to 
Posix (and me :-).  

The idea is that every computer on the world internally runs on Greenwich
Mean Time (GMT), or better called Universal Coordinated Time (UCT). The
TZ indicates how far the particular computer is off GMT. Extra the TZ
indicates whether there is DST, and the start and end date. When the local
time should be known for display or reference ('date', news/mail Date: 
field, 'cron') the internal GMT combined with TZ gives the local time.

Here is a piece about TZ from the 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.

For reasons of simplicity I twice took the liberty of deviating from the
straight Posix, namely time specification will be ignored, and is hardcoded 
to 02:00:00 and this TZ-stuff only works properly on the Nothern Hemisphere.
The time specification would mean much ado about little as nearly all time
changes take place at 02:00 (or thereabouts). The TZ-stuff will easily work 
on the Southern Hemisphere by swopping two hunk of source (It is indicated 
in the file). Those who will not accept this: Sorry for them.

Now the ten steps of the installation:
 1. unpack the thing below               uud mail
                                         decompress ctime.shar.Z
                                         sh < ctime.shar
 2. Read the Readme                      more Readme (this text)
 3. put ctime.c in /usr/src/lib/ansi     mv ctime.c /usr/src/lib/ansi
 4. compile it to ctime.s                make ctime.s
 5. replace the ctime.s now in libc.a    ar rv /usr/lib/libc.a ctime.s
 6. as you don't believe me....          mv Date.c /usr/src/commands
    compile the demo programme and...    make f=Date
    give it a try                        TZ=Foo2Bar,1,300;Date
 6. Then, convinced, you recompile all programmes that use the time 
    functions, such as date, cron, mail, inews
 7. Edit /etc/rc and put a TZ definition up at the beginning, especially
    before date is run and before cron is started
 8. Edit /etc/profile and put the same TZ definition in there
 9. login anew as root, and set the battery-backup'ed clock to GMT, or
    if you can use 'date' for that (volatile clock== b-b'ed clock) or if
    you have no b-b'ed clock (then why bother about TZ) to local time, as
    the mktime() in 'date' will do the TZ translation for you.
10. Done. (you may want to reboot to be sure, but it is not needed).

Several examples how to define your TZ:
Middle-Europe (=Central Europe), e.g. The Netherlands, Belgium, Germany,
France, Italy, Austria, Switzerland, Spain, Portugal
               MET-01:00:00METDST+01:00:00,M3.5.0/02:00:00,M9.5.0/02:00:00
           or  MET-1METDST,M3.5.0,M9.5.0 (using the defaults :-)
UK             GMT0BST,M3.5.0,M9.5.0 
Western SU     WSU-3WSUDST,M3.5.0,M9.5.0 (knowledgeable guess)
Eastern USA    EST5EDT (US rule is default) 
Central USA    CST6CDT 
Newfoundland   NFLD3:30NFLD
Central Oz     OZCST-9:30 (doesn't have DST).

Those of who are still reading here, 
Would you, in case you think this so rewarding that you put it into action,
be so kind to drop me a line stating so? Thanks.

Met vriendelijke groeten, Wim `Blue Baron' van Dorst.
---------------------------------------------------------------------
Blue Baron = Wim van Dorst, Voice (+31) 074-443937, (+31) 02152-42319
(-:       baron@wiesje.hobby.nl           tgcpwd@urc.tue.nl       :-)
---------------------------------------------------------------------
