Path: utzoo!news-server.csri.toronto.edu!rutgers!att!linac!uwm.edu!cs.utexas.edu!uunet!mcsun!cernvax!cernvax.cern.ch From: dietrich@cernvax.cern.ch (dietrich wiegandt) Newsgroups: comp.unix.ultrix Subject: ULTRIX and Daylight Saving Time in Central Europe Message-ID: <4490@cernvax.cern.ch> Date: 12 Mar 91 08:38:04 GMT Sender: dietrich@cernvax.cern.ch Organization: CERN, European Laboratory for Particle Physics Lines: 81 This year, central Europe switches to daylight saving time (DST) in the early morning hours of Sunday, March, 31. The algorithm used in the ctime subroutine in Ultrix version 3.x and earlier apparently cannot cope with this and 'last Sunday in March' is calculated to be March 24. This has been verified using a little test program that takes a number of days as argument, adds this to the current value of the internal representation of time and date, hands the result to ctime for conversion and prints the output. To prevent the switch to DST happening too early on an ULTRIX system version prior to 4.0 and to make it happen at the correct moment, 1) make sure the DST indicator is set to zero before March, 24, 2 a.m. and stays like that till March 31, 2 a.m. 2) make sure the DST indicator is set to four on March, 31, 2 a.m. The easiest way to modify the DST indicator is to use the date command: date `date '+%H%M.%S'`n will set it to zero and leave the current date and time unchanged, date `date '+%H%M.%S'`m will set it to four. Note that you should repeat this command if you boot your system before March 31, 2 a.m. Both these commands must be typed exactly as they have been given above. Here is a proposal on how to proceed: The following shell script changes the value of the DST indicator to zero (-off) or four (-on): #!/bin/sh case $1 in -on) /bin/date `date '+%H%M.%S'`m;; -off) /bin/date `date '+%H%M.%S'`n;; *) echo "Usage: $0 -on or $0 -off" exit 1;; esac exit 0 Install it as, say, dstset in /etc owned by root, don't forget to make it executable by root, run it with the argument -off. Install another little script called fixdst in /etc with owner root and executable by root: #!bin/sh /etc/dstset -on rm /etc/fixdst Add the following entry to /etc/crontab: 0 2 31 3 * /etc/fixdst Fixdst will thus be executed at 02.00 on March 31 and make sure that the DST indicator is set to four and the script removed after execution, as its presence is used as a switch in the following lines to be added to your /etc/rc.local: [ -f /etc/fixdst ] && { /etc/dstset -off ; echo ' fixdst.' >/dev/console } which sets the DST indicator to zero at boot time as long as there is a file called /etc/fixdst. The best method to ensure proper date and time behaviour on ULTRIX 4.0 (and higher, I guess) seems to be to link localtime to MET or CET in /etc/zoneinfo (see the manual page for ctime). Good luck, Dietrich Wiegandt CERN CN Division CH-1211 Geneve 23 Switzerland