1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-26 04:02:06 +00:00

Make (STATUS DATE) return a four-digit year.

This is a change to the API, but existing users are already inconsistent
in how they handle 2-digit years -- some assume it's year % 100 (as the
documentation says), some assume it's year - 1900, and some
string-prepend "19" -- so most have Y2K problems that need fixing.

As it's now reading the date using two UUOs, it needs to be careful to
check that the year hasn't rolled over between the two, as LIBDOC; TIME
does for the day.

I've updated all four implementations of SDATE, but only tested the ITS
version.
This commit is contained in:
Adam Sampson
2018-07-27 17:07:58 +01:00
committed by Adam Sampson
parent 6198526639
commit aadfbe890a
2 changed files with 19 additions and 10 deletions

View File

@@ -617,15 +617,26 @@ SUBTTL STATUS TIME, DATE, UNAME, USERID, JNAME, JNUMBER, SUBSYSTEM
IFN ITS,[
STIME: .RTIME TT,
JRST SDATE+1
SDATE: .RDATE TT,
AOJE TT,FALSE
MOVE D,TT
SUB D,[202020202021] ;21 ADJUSTS FOR THE AOJE
JSP F,STCVT
JSP F,STCVT
JSP F,STCVT
JSP F,STCVT ;Hour
JRST SDAT2
SDATE: .RYEAR T, ;Get year info
JUMPE T,FALSE
.RDATE D, ;Get sixbit date
AOJE D,FALSE
.RYEAR TT, ;Has the year just rolled over?
CAME T,TT
JRST SDATE ; Happy new year! Try again
HRRZ TT,T ;4-digit year
JSP T,FXCONS
PUSH P,A
SUB D,[202020202021] ;21 adjusts for the AOJE
LSH D,12. ;Discard 2-digit year
SDAT2: JSP F,STCVT ;Month (or minute)
JSP F,STCVT ;Day (or second)
MOVNI T,3
JRST LIST
@@ -710,7 +721,6 @@ SDATE: MOVE R,[%CNYER]
MOVE TT,[%CNDAY]
GETTAB R,
JRST FALSE
SUBI R,1900.
JRST STIM2
STIME: MOVE R,[%CNHOR]
@@ -741,7 +751,7 @@ SDATE: DATE D, ;DATE IN D = <<YEAR-1964.>*12.+MONTH-1>*31.+DAY-1
MOVE T,R
IDIVI D,12. ;REMAINDER HERE IS MONTH-1
AOJ R,
ADDI D,64. ;QUOTIENT IN D IS YEAR-1964.
ADDI D,1964. ;QUOTIENT IN D IS YEAR-1964.
PUSH FXP,D
PUSH FXP,R
PUSH FXP,T
@@ -812,7 +822,6 @@ STIME1: PUSHJ P,CONS1FX ;CONS R, D, TT INTO A LIST OF FIXNUMS
SDATE: PUSHJ P,SDATIM ;RETURNS DATE IN D AND R
HLRZ TT,R ;DAY-1
HLRZ R,D ;YEAR
SUBI R,1900. ;REDUCE IT TO A YEAR MOD 100.
MOVEI D,1(D) ;MONTH
AOJA TT,STIME1 ;INCREMENT DAY-1 TO DAY, AND GO CONS