From - Thu Sep 04 07:26:09 1997
Path: news.mitre.org!blanket.mitre.org!nntprelay.mathworks.com!cam-news-hub1.bbnplanet.com!cam-news-feed2.bbnplanet.com!news.bbnplanet.com!delta.process.com!process.com!volz
Newsgroups: comp.os.vms,vmsnet.networks.tcp-ip.tcpware
Subject: Re: NTP and Daylight savings time
Message-ID: <1997Sep3.200204@process.com>
From: volz@process.com (Bernie Volz)
Date: 3 Sep 97 20:02:04 -0400
References: <340D5AA2.9D092A51@elca-matrix.ch>
Nntp-Posting-Host: alcor.process.com
Lines: 107
Xref: news.mitre.org comp.os.vms:177943 vmsnet.networks.tcp-ip.tcpware:564

In article <340D5AA2.9D092A51@elca-matrix.ch>, Mats Weber <Mats.Weber@elca-matrix.ch> writes:
> I am running DEC alphas under VMS 6.2 with TCPware 5.0 and I use TCPware's NTP
> to keep their clocks in synch with the rest of the network.
> 
> Is there an automatic way of changing from and to daylight savings time (with
> or without TCPware's NTP).
> 
> BTW TCPware does not seem to be aware of daylight savings time. I have to
> change the timezone in tcpware_configure.com and restart every march and
> october. Is there a better way ?

Here's a .COM file we use at Process Software that runs once a day
(usually early in the morning hours, best time is probably between 2-6
AM depending on what tasks you may have running in the early morning
hours). We've used this for years and haven't had to do any time zone
adjustments.

REVIEW THIS CODE BEFORE USING IT! YOU WILL MOST LIKELY NEED TO TAILOR IT
A BIT!

Anyway, it does the following:
	- Determines if the time zone has changed and if so, makes the
	  change.
	- Synchronizes the clocks on the cluster (that's so NTP need only
	  run on one node in the cluster). Yeah, this time sync isn't as
	  good as if NTP was running everywhere, but we're not so concerned
	  about a few seconds. If you are ...
	- Requeues the job.

It assumes that the first time the job is queued, the timezone is
correct (it the saves the previous setting as a parameter for the next
time it is run). Once this job is set up and running, DON'T change the
timezone using alternate means.

This only need run on one node in the cluster.

It is left as an exercise to deal with TCPware's startup - since the
TCPWARE_CONFIGURE.COM file contains the time zone. (Hint - after it
starts, run the time zone checking/changing part of the .COM but just do
the NETCU SET TIMEZONE locally, not cluster wide.)

Anyway, use it and modify it as you like. If it doesn't work for you,
sorry. If you figure out a more efficient way to do this, good for you!

Warning: This is set up to deal with US time zone changes ONLY and for
the current law. If Congress changes the rules, the code will need to
change.

Enjoy,

- Bernie Volz
  Process Software Corporation

$ SET NOON
$!
$ DAY_Sunday	= 0
$ DAY_Monday	= 6
$ DAY_Tuesday	= 5
$ DAY_Wednesday	= 4
$ DAY_Thursday	= 3
$ DAY_Friday	= 2
$ DAY_Saturday	= 1
$ TEMPN = DAY_'F$CVTIME("01-APR",,"WEEKDAY")' + 1
$ ST = F$CVTIME("''TEMPN'-APR:02:00:00")
$ DAY_Sunday	= 0
$ DAY_Monday	= 1
$ DAY_Tuesday	= 2
$ DAY_Wednesday	= 3
$ DAY_Thursday	= 4
$ DAY_Friday	= 5
$ DAY_Saturday	= 6
$ TEMPN = 31 - DAY_'F$CVTIME("31-OCT",,"WEEKDAY")'
$ ET = F$CVTIME("''TEMPN'-OCT:02:00:00")
$ CT = F$CVTIME()
$ TIMEZONE = "EST"
$ IF ((CT .GES. ST) .AND. (CT .LTS. ET)) THEN TIMEZONE = "EDT"
$ IF (P1 .EQS. "") THEN P1 = TIMEZONE
$ IF (TIMEZONE .EQS. P1) THEN GOTO NO_TIMEZONE_CHANGE
$ P1 = TIMEZONE
$ DELTA_TIME = "-01:00:00.00"					! Change to EST
$ IF (TIMEZONE .EQS. "EDT") THEN DELTA_TIME = "+01:00:00.00"	! Change to EDT
$ SET TIME="''DELTA_TIME'"/CLUSTER
$! Now fix up TCPware items as well
$ UT_OFFSET = "-0500"
$ IF (TIMEZONE .EQS. "EDT") THEN UT_OFFSET = "-0400"
$ OPEN/WRITE TZFIXUPS SYS$COMMON:[SYSMGR]00TEMPTZ.COM
$ WRITE TZFIXUPS "$ SET NOON"
$ WRITE TZFIXUPS "$ NETCU :== $TCPWARE:NETCU"
$ WRITE TZFIXUPS "$ NETCU SET TIMEZONE ''UT_OFFSET'"
$ WRITE TZFIXUPS "$ DEFINE/SYSTEM/EXEC NEWS_TIMEZONE ''UT_OFFSET'"
$ CLOSE TZFIXUPS
$ FILE = F$SEARCH("SYS$COMMON:[SYSMGR]00TEMPTZ.COM")
$ OPEN/WRITE SYSFIL SYS$COMMON:[SYSMGR]00TEMPTZ1.COM
$ WRITE SYSFIL "$ MCR SYSMAN"
$ WRITE SYSFIL "  SET ENVIRONMENT/CLUSTER"
$ WRITE SYSFIL "  DO @''FILE'"
$ CLOSE SYSFIL
$ @SYS$COMMON:[SYSMGR]00TEMPTZ1.COM
$ DELETE/NOLOG SYS$COMMON:[SYSMGR]00TEMPTZ1.COM;*
$ DELETE 'FILE'/NOLOG
$!
$NO_TIMEZONE_CHANGE:
$ SET TIME="+00:00:00.00"/CLUSTER
$!
$ SCSNODE = F$EDIT(F$GETSYI("SCSNODE"),"COLLAPSE")
$ SUBMIT/NOPRINT/NOLOG/RESTART/AFTER="TOMORROW:+02:00:00" -
	/QUE=SYS$BATCH$'SCSNODE'/PARAM="''P1'" SYS$MANAGER:TIMEKEEPER