From f945bff1002d22a6cd913ae8a4b8bbdc77f22afa Mon Sep 17 00:00:00 2001 From: Eric Swenson Date: Sun, 24 Sep 2023 12:58:57 -0700 Subject: [PATCH] Updated netime and times to handle daily savings time. --- src/sysen1/{netime.127 => netime.128} | 58 +++++++++++++++++++----- src/sysnet/{times.73 => times.74} | 63 ++++++++++++++++++++++++--- 2 files changed, 103 insertions(+), 18 deletions(-) rename src/sysen1/{netime.127 => netime.128} (91%) mode change 100755 => 100644 rename src/sysnet/{times.73 => times.74} (90%) diff --git a/src/sysen1/netime.127 b/src/sysen1/netime.128 old mode 100755 new mode 100644 similarity index 91% rename from src/sysen1/netime.127 rename to src/sysen1/netime.128 index 76502e45..e1d29edc --- a/src/sysen1/netime.127 +++ b/src/sysen1/netime.128 @@ -139,6 +139,26 @@ hosts: [asciz "EMACK-AND-BOLIOS"] nhosts==:.-hosts + +DEFINE TZONE STD,DST + [ASCIZ /STD/],,[ASCIZ /DST/] +TERMIN + repeat 12.-2,TZONE ;Dunno -3..-12 + tzone EET,EEST ;-2 + tzone CET,CEST ;-1 +tznam: TZONE GMT,BST ; 0 How to ask for British Summer Time?? + TZONE ; 1 + TZONE ; 2 + TZONE ; 3 (NST = Newfoundland is -0330) + TZONE AST,ADT ; 4 Atlantic + TZONE EST,EDT ; 5 Eastern + TZONE CST,CDT ; 6 Central + TZONE MST,MDT ; 7 Mountain + TZONE PST,PDT ; 8 Pacific + TZONE YST,YDT ; 9 Yukon + TZONE HST,HDT ; 10 Alaska-Hawaii + TZONE BST,BDT ; 11 Bering + REPEAT 24.-11.,TZONE ; 12-24 unspecified ;;; Parameters that can be patched: @@ -150,7 +170,7 @@ wait: 20.*60. ; Wait 20 seconds polling other hosts. numerq: 2 ; Ceiling of 2/3 of the hosts that respond denomq: 3 ; must agree on the time. -minq: 4 ; Insist on at least 4 hosts with times in +minq: 3 ; Insist on at least 3 hosts with times in ; agreement. spread: 400. ; Times agree if they differ by less than @@ -160,6 +180,9 @@ days: 3 ; If machine looks like it was down for ; this many days, then require a human to ; set the time. +tzhdif: 0 ; time zone difference in hours +tzsdif: 0 ; time zone difference in seconds + filesn: sixbit /DRAGON/ ; The creation date of this file is some filen1: sixbit /DRAGON/ ; indication of what time the system last filen2: sixbit /HOARD/ ; thought it was. @@ -227,6 +250,14 @@ irps sym,,[ka10p,kl10p,ks10p,pdtime,fyear] .lose movem tt,sym termin + move tt,[squoze 0,tzone] + .eval tt, + jrst [movei tt,s%est + jrst .+2] + movem tt,tzhdif + imuli tt,60.*60. + movem tt,tzsdif + move tt,[squoze 0,ksfreq] .eval tt, movei tt,<<1000._12.>+30.>/60. @@ -239,13 +270,14 @@ termin setzm times+0 move tt,[times+0,,times+1] blt tt,times+nhosts-1 - movei a,%corfc - dpb a,[$cpkop opkt] + movei a,%corfc ; request for connection + dpb a,[$cpkop opkt] ; chaosnet operation movei a,4 - dpb a,[$cpknb opkt] + dpb a,[$cpknb opkt] ; number of bytes move a,[.byte 8 ? "T ? "I ? "M ? "E] - movem a,opkt+%cpkdt + movem a,opkt+%cpkdt ; packet data setzm count + hrloi c,-1-nhosts ; C: aobjn into hosts loop: tlnn netmsk\%ftime .hang @@ -464,7 +496,7 @@ gotime: movem a,lowest imul c,[s%y] add b,c ; B: Seconds from 1/1/00 to this year. move a,time - subi a,s%est ; GMT -> EST + sub a,tzsdif sub a,b imuli a,60. movem a,ticks @@ -487,7 +519,7 @@ notks: move a,clktim skipe ka10p .lose doit: sub a,ticks ; A: offset for loading into PDTIME - format "~&Setting the time to be ~Q ~S ~ + format "~&Setting the time to be ~Q ~A ~ (supplied by ~A).~&",[qtime,qzone,host] move tt,fyear hrli tt,year @@ -591,14 +623,18 @@ tablex: format "~&Low=~D High=~D Median=~D",[lowest,highest,median] ;;; A (arg): network time ;;; A (val): disk format date ;;; E (val): SIXBIT of timezone -cvtime: subi a,s%est ; GMT -> EST +cvtime: sub a,tzsdif ; GMT -> local time zone call datime"sectim ; -> disk format date save b + save c movei b,60.*60. + move c,tzhdif ; get time zone diff in hours call datime"odayl - skipa e,[sixbit /EDT/] - skipa e,[sixbit /EST/] - call datime"timadd + jrst [hrrz e,tznam(c) ; get DST TZ name + call datime"timadd ; account for DST + jrst .+2] + hlrz e,tznam(c) ; get standard TZ name + rest c rest b return diff --git a/src/sysnet/times.73 b/src/sysnet/times.74 similarity index 90% rename from src/sysnet/times.73 rename to src/sysnet/times.74 index 9c48c33d..91f36c45 100644 --- a/src/sysnet/times.73 +++ b/src/sysnet/times.74 @@ -221,6 +221,22 @@ MAPHST: MOVEI A,LSTPAG ;Page to map HOSTS3 in. MOVEI B,0 CALL NETWRK"HSTMAP ;Map in the host table. JSR AUTPSY +gmtdif==5. + +tzcode: + .rlpdtm a, ; get in a and b, # secs since beg of year in a + came a,[-1] + camn,[-1] + jrst notz ; can't get tz + tlnn b,10000 ; tz known? + jrst notz ; no + ldb a,[230400,,b] ; get absolute time TZ + tlne c,4000 ; negative? + movns a + skipa +notz: movei a,gmtdif ; default tz=5 + movem a,tzdiff ; save tz diff + SKIPE CHAOSP ;Tell luser which network we are using. JRST [ OUT(,("AChecking the time using CHAOS protocol: ")) MOVEI E,CHATAB ;(Seperate tables for TCP and CHAOS.) @@ -248,6 +264,7 @@ SETUP3: AOBJN C,SETUP2 ;Go get another. JRST [ OUT(,("Subnet Site Greenwich Mean Time Local Time"),CRLF) JRST SETUP9 ] OUT(,("Network Site Greenwich Mean Time Local Time"),CRLF) + SETUP9: MOVSI C,-NHOSTS ;Number of hosts to poll. LOOP: SKIPN A,HOSTS(C) ;Get host address in A. JRST LOOP8 ; Ignore if zero. @@ -268,18 +285,30 @@ LOOP: SKIPN A,HOSTS(C) ;Get host address in A. LOOP5: MOVE B,A ;Remember network time. CALL DATIME"SECTIM ;Convert to time word. EXCH A,B ;GMT in B. - SUBI A,DATIME"ESTDIF*60.*60. + move tt,tzdiff ; get time zone difference + imuli tt,60. + imuli tt,60. + sub a,tt CALL DATIME"SECTIM PUSH P,C PUSH P,B - MOVE C,[SIXBIT / EST./] + move b,tzdiff + hlrz c,tznam(b) ;Assume standard + call datime"odayl + jrst [hrrz c,tznam(b) ; daylight + skipn (c) + MOVE C,[ASCIZ / EDT./] + jrst .+3] + skipn (c) + MOVE C,[ASCIZ / EST./] + MOVEI B,3600. CALL DATIME"ODAYL - CALL [ MOVE C,[SIXBIT / EDT./] - JRST DATIME"TIMADD ] + CALL DATIME"TIMADD POP P,B + MOVE C,(C) OUT(,("H'"),TIM(MDYT,B),(" -> ")) - OUT(,TIM(MDYT,A),6F(C),CRLF) + OUT(,TIM(MDYT,A),(" "),TZ(C),CRLF) POP P,C LOOP8: AOBJN C,LOOP @@ -502,7 +531,25 @@ CHATAB: ; [ASCIZ /APIARY-4/] CHATBL==.-CHATAB - +DEFINE TZONE STD,DST + [ASCIZ /STD/],,[ASCIZ /DST/] +TERMIN + repeat 12.-2,TZONE ;Dunno -3..-12 + tzone EET,EEST ;-2 + tzone CET,CEST ;-1 +tznam: TZONE GMT,BST ; 0 How to ask for British Summer Time?? + TZONE ; 1 + TZONE ; 2 + TZONE ; 3 (NST = Newfoundland is -0330) + TZONE AST,ADT ; 4 Atlantic + TZONE EST,EDT ; 5 Eastern + TZONE CST,CDT ; 6 Central + TZONE MST,MDT ; 7 Mountain + TZONE PST,PDT ; 8 Pacific + TZONE YST,YDT ; 9 Yukon + TZONE HST,HDT ; 10 Alaska-Hawaii + TZONE BST,BDT ; 11 Bering + REPEAT 24.-11.,TZONE ; 12-24 unspecified SUBTTL Data. @@ -513,7 +560,7 @@ PDL: BLOCK PDLLEN ;The Stack. DEBUG: 0 ;-1 => Debugging. TCPP: -1 ;-1 => Try TCP time servers. NCPP: 0 ;-1 => Try NCP time servers. -CHAOSP: 0 ;-1 => Try Chaosnet servers. +CHAOSP: 0 ;-1 => Try Chaosnet servers (gets set to -1 if JNAME is CTIMES) UDPP: 0 ;-1 => Try ARPAnet UDP servers (not implemented yet). TCMXH: 0 @@ -524,6 +571,8 @@ OWNHST: 0 ;My host address. HSTNUM: 0 ;HOSTS3 address to connect to. GOTTCP: 0 ;-1 => Got the info from TCP. +TZDIFF: 0 + NETDEV: SIXBIT /NET/ NTMSOC: 45 ; Socket to connect to HOSTS: BLOCK NHOSTS ;Table of host addresses.