1
0
mirror of https://github.com/PDP-10/its.git synced 2026-04-25 11:51:38 +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

@@ -3599,7 +3599,7 @@ Note: the various enquiries related to time may return nil in the rare
circumstance that LISP cannot determine what time it is. circumstance that LISP cannot determine what time it is.
date (status date) returns a 3-list of fixnums indicating the current date date (status date) returns a 3-list of fixnums indicating the current date
as (last-two-digits-of-the-year month-number day). as (year month-number day). The year value is complete (e.g. 2001.).
dow (status dow) returns an interned atomic symbol which is the name of dow (status dow) returns an interned atomic symbol which is the name of
the current day of the week. the current day of the week.

View File

@@ -617,15 +617,26 @@ SUBTTL STATUS TIME, DATE, UNAME, USERID, JNAME, JNUMBER, SUBSYSTEM
IFN ITS,[ IFN ITS,[
STIME: .RTIME TT, STIME: .RTIME TT,
JRST SDATE+1
SDATE: .RDATE TT,
AOJE TT,FALSE AOJE TT,FALSE
MOVE D,TT MOVE D,TT
SUB D,[202020202021] ;21 ADJUSTS FOR THE AOJE SUB D,[202020202021] ;21 ADJUSTS FOR THE AOJE
JSP F,STCVT JSP F,STCVT ;Hour
JSP F,STCVT JRST SDAT2
JSP F,STCVT
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 MOVNI T,3
JRST LIST JRST LIST
@@ -710,7 +721,6 @@ SDATE: MOVE R,[%CNYER]
MOVE TT,[%CNDAY] MOVE TT,[%CNDAY]
GETTAB R, GETTAB R,
JRST FALSE JRST FALSE
SUBI R,1900.
JRST STIM2 JRST STIM2
STIME: MOVE R,[%CNHOR] 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 MOVE T,R
IDIVI D,12. ;REMAINDER HERE IS MONTH-1 IDIVI D,12. ;REMAINDER HERE IS MONTH-1
AOJ R, 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,D
PUSH FXP,R PUSH FXP,R
PUSH FXP,T 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 SDATE: PUSHJ P,SDATIM ;RETURNS DATE IN D AND R
HLRZ TT,R ;DAY-1 HLRZ TT,R ;DAY-1
HLRZ R,D ;YEAR HLRZ R,D ;YEAR
SUBI R,1900. ;REDUCE IT TO A YEAR MOD 100.
MOVEI D,1(D) ;MONTH MOVEI D,1(D) ;MONTH
AOJA TT,STIME1 ;INCREMENT DAY-1 TO DAY, AND GO CONS AOJA TT,STIME1 ;INCREMENT DAY-1 TO DAY, AND GO CONS