From:	CSBVAX::MRGATE!@KL.SRI.Com:R021JM9W@VB.CC.CMU.EDU@SMTP 23-OCT-1987 22:29
To:	EVERHART
Subj:	Changing from daylight time to standard time

Received: from VB.CC.CMU.EDU by KL.SRI.COM with TCP; Fri 23 Oct 87 14:05:55-PDT
Received: from Mailer by VB.CC.CMU.EDU; Fri, 23 Oct 87 17:05 EDT
Date: Fri, 23 Oct 87 17:05:34 EDT
From: Jim Murawski <R021JM9W@VB.CC.CMU.EDU>
Subject: Changing from daylight time to standard time
To: Info-Vax@KL.SRI.COM


        In most of North America, standard time starts this Sunday
        (October 25th) at 2:00.  I have whipped up a command procedure
        (that'll run in batch) to automatically change the system time
        and notify the console that the time has changed.  This same
        procedure can also be used when changing from standard time
        to daylight time.  To submit it, type:

        $ Submit Timechange /Parameter=("DAYLIGHT/STANDARD") -
                /After="25-Oct-1987 02:00" /[Your favorite qualifiers]

        In case your Vax is down at 2:00 on Sunday, the batch job will
        still set your time back by 1 hour whenever the Vax comes back up,
        so the time will still be correct.  Note that you may lose "a
        second or so" when changing the time via this procedure, but I'm
        sure most of you will find it acceptable.
                                -Jim Murawski
                                -Carnegie Mellon Computing Services
                                -Pittsburgh, PA
                                -R021JM9W@VB.CC.CMU.EDU (or CMCCVB.Bitnet)

$!       sys$user1:[r021jm9w]timechange.com;22				    
$!       Last Edit Date = Fri Oct 23 16:50:12 1987    R021JM9W		    
$!
$!      **  Revision History  (Start)  **
$!      ---------------------------------
$!      Fri Oct 23 16:50:12 1987 R021JM9W : Initial version.
$!      ---------------------------------
$!      **  Revision History (Finish)  **
$!
$!  TIMECHANGE - Change the time from Daylight to Standard or vice-versa,
$!               depending on the value of P1 (parameter 1 in batch).
$!
$ Save_Ver = F$Verify (1)
$ On Error Then Goto ABORT
$ On Control_Y Then Goto ABORT
$ P1 = F$Edit (P1, "UPCASE,TRIM")
$ If P1 .EQS. "STANDARD/DAYLIGHT" Then Goto START
$ If P1 .EQS. "DAYLIGHT/STANDARD" Then Goto START
$ Goto ABORT
$START:
$ Prev_Priv = F$Setprv ("OPER,LOG_IO")
$ Cur_Timestamp = F$Time ()
$ Cur_Date = F$Cvtime (Cur_Timestamp, "ABSOLUTE", "DATE")
$ Cur_Hour = F$Cvtime (Cur_Timestamp, , "HOUR")
$ Cur_Minute = F$Cvtime (Cur_Timestamp, , "MINUTE")
$ Cur_Second = F$Cvtime (Cur_Timestamp, , "SECOND")
$ Cur_Hundredth = F$Cvtime (Cur_Timestamp, , "HUNDREDTH")
$ If P1 .EQS. "STANDARD/DAYLIGHT" Then Goto ADD_HOUR
$SUB_HOUR:
$ New_Hour = F$String (F$Integer (Cur_Hour) - 1)
$ Goto NEW_TIME
$ADD_HOUR:
$ New_Hour = F$String (F$Integer (Cur_Hour) + 1)
$NEW_TIME:
$ New_Timestamp = Cur_Date + " " + New_Hour + ":" + Cur_Minute + ":" -
        + Cur_Second + "." + Cur_Hundredth
$ Set Time="''New_Timestamp'"
$ Prev_Priv = F$Setprv (Prev_Priv)
$!
$!  Notify the operator's console about the new time and send mail when OK
$!
$ Reply /Term=OPA0 /Bell -
        "Changed system time from ''Cur_Timestamp' to ''New_Timestamp'"
$ Mail /Subject="Timechange OK!!" NL: "''F$Getjpi ("", "USERNAME")'"
$ Save_Ver = F$Verify (Save_Ver)
$ Exit
$ABORT:
$ Show Symbol $Status
$ Save_Stat = $Status
$!
$!  Send mail on error and notify the operator's console
$!
$ Mail /Subject="Timechange Had Errors!!" NL: "''F$Getjpi ("", "USERNAME")'"
$ Reply /Term=OPA0 /Bell -
        "ERROR changing system time, please call ''F$Getjpi ("", "Username")'"
$ Save_Ver = F$Verify (Save_Ver)
$ Exit Save_Stat
$!
$!  End of TIMECHANGE.COM
