Google
 

Trailing-Edge - PDP-10 Archives - bb-kl11c-bm_tops20_v6_1_atpch1_16 - autopatch/pat.c14
There are no other files named pat.c14 in the archive.
 INS 1/1	;14C1
	; *** Edit 443 to PAT.MAC by WONG on 6-Jun-86, for SPR #20582
	; Fix MSTIME to return the correct millisecond. This edit supersedes edit
	; 416,417 429,430.
 REP 10/2	;14C2
	.EDIT==442	;EDIT NUMBER by DSW
 WIT
	.EDIT==443
 REP 32/86	;14C3
	;**;[416] Delete 1 line at MSTIME+11 AND 5 lines at MSTIME+13
	MSTIME:	TIME			;READ TIME SINCE LOAD IN MS
		MOVE F,A		;SAVE TIME FOR LATER
		ADD A,ITIME		;ADD IN TIME FROM MIDNIGHT TO LOAD TIME
		IDIV A,[^D24*^D60*^D60*^D1000] ;CONVERT TO MODULO ONE DAY
		MOVE A,B		;GET TIME SINCE LATEST MIDNIGHT
		SETO B,			;NOW GET ACTUAL TIME SINCE MIDNIGHT
		SETZ D,			;...
		ODCNV
		 ERJMP STOTAC		;IF FAILED, USE PREVIOUSLY CALCULATED ANSWER
		MOVEI B,^D1000		;CONVERT SECONDS TO MILLISECONDS
		IMULI B,0(D)
	;**;[417] Insert 6 lines at MSTIME +10 (SPR #19849)
		CAMN B,A		;[417] HAS CLOCK DRIFTED?
		  JRST STOTAC		;[417] NO
	;**;[430] insert 4 lines at mstime +12 (SPR #20385)
		CAIL B,<^D60*^D1000>	;[430] MAYBE WE JUMPED OVER MIDNIGHT ?
		 JRST MSTM1		;[430] 
		CAML A,[^D24*^D59*^D60*^D1000] ;[430] 
		 JRST MSTIME		;[430] YES DO IT AGAIN
	MSTM1:	PUSH P,B		;[417] YES, SAVE TIME
		SUB B,F			;[417] GET NEW BASE TIME
		MOVEM B,ITIME		;[417] STORE NEW BASE
	;**;[429] REPLACE 1 LINE AND INSERT 3 AT MSTIME+18 (SPR 19841)	
		POP P,C			;[429] [417] GET BACK ANSWER
		IDIVI A,^D1000		;[429] 
		ADD C,B			;[429] APPLY MSECONDS
		MOVE A,C		;[429] 
 WIT
	;**;[443]At MSTIME:+0L replace 28L with 15 lines  JYCW 6/3/86
	;Since the MONITOR  rounds off to the nearest second when determining the time
	;(ODCNV), we must do some guessing as to whether a round off did or did not
	;occur. The millisecond from the TIME JSYS is divided by 1000 to get the ms
	;part of the up time.  It's this value we use to determine whether there was a
	;round off.  If it's greater or equal to 500 we assume that the MONITOR did
	;round off the time (ODCNV) so we subtract 1 sec and add the ms to the time.
	;If it's less than 500 we assume that there is no round off and just add the ms
	;to the time.  Then we check this value against the previous base time to see
	;if the calculated time is in the future.  If it's not we add back the second
	;because there was no round off. 
	MSTIME:	SETO B,			;[443]Now get actual time since midnight
		SETZ D,			;...
		ODCNV
		HRRZ C,D		;[443]Get the time
		IMULI C,^D1000		;[443]Convert seconds to milliseconds
		TIME			;[443]Get uptime in ms
		IDIV A,B		;[443]Convert to sec 
		MOVE A,B		;[443]remember the left over ms
		CAIL A,^D500		;[443]Round off?
		SUBI C,^D1000		;[443]Yes, sub 1 sec
		ADD A,C			;[443]Get the time in ms
		CAMGE A,ITIME		;[443]Is it greater than before?
		ADDI A,^D1000		;[443]No, add back the second
		MOVEM A,ITIME		;[443]Update the base time
 REP 54/114	;14C4
		TIME			;GET TIME SINCE LOAD
		SETO B,			;BACK TO GETTING TIME SINCE MIDNIGHT
		SETZ D,
		ODCNV
		CAIE E,0(D)		;MAKE SURE CLOCK DIDNOT TICK JUST THEN
		  JRST ONCE3		;IT DID, GO TRY AGAIN
		IMULI E,^D1000		;CONVERT SECONDS TO MILLISECONDS
		SUB E,A			;GET ACTUAL TIME IN MILLISECONDS
 WIT
	;**;[443]At ONCE3:+4L replace 8 lines with 5 lines  JYCW  5/29/86
		IMULI E,^D1000		;[443]Convert seconds to milliseconds
		TIME			;[443]Get time since load
		IDIV A,B		;[443]Convert to sec
		MOVE A,B		;[443]Only want the millisecond part
		CAIL A,^D500		;[443]Was there a round off for ODCNV
		SUBI E,^D1000		;[443]Yes, subtract 1 sec
		ADD E,A			;[443]No, get actual time in milliseconds
 SUM 153645