;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 126.115
;;; Written 18-Oct-88 20:50:06 by keith (Keith Corbett) at site Gigamos Cambridge
;;; while running on Breaking Glass from band 3
;;; with Experimental System 126.114, Experimental ZWEI 126.20, Experimental ZMail 74.9, Experimental Local-File 76.0, Experimental File-Server 25.0, Experimental Lambda-Diag 18.0, Experimental Unix-Interface 15.0, Experimental Tape 26.4, Experimental IMicro 20.0, Microcode 1762, SDU Boot Tape 3.14, SDU ROM 103.



; From file DJ: L.SYS2; LMMAC.LISP#473 at 18-Oct-88 20:50:07
#10R SYSTEM-INTERNALS#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: SYS2; LMMAC  "


;;;TIME comparison functions
;;;

;;;||| Portabilize, 'tho Falcon may have bigger/different time values(?)  -Keith 10/18/88

(defconstant %%time-compare-byte-spec (BYTE 23. 0.)
  "Byte spec for comparable portion of time values.")

(defconstant %time-compare-bit-mask #o20000000
  "Bit mask for comparing order of two time values.")

(eval-when (compile)  
  (putprop 'time-lessp      nil 'compiler:legal-byte-specifier)
  (putprop 'time-difference nil 'compiler:legal-byte-specifier)
  (putprop 'time-increment  nil 'compiler:legal-byte-specifier))

(DEFSUBST TIME-LESSP (TIME1 TIME2)
  "Compare two values of processor clock time [see (ZL:TIME)];
return T if TIME1 is less than TIME2.
Both time values are measured in 60'ths of a second.
If two time values too far apart are compared, you get the wrong answer,
since the processor clock wraps around.
DO NOT USE (ZL:TIME) for applications where that can matter."
  (BIT-TEST %time-compare-bit-mask (%POINTER-DIFFERENCE TIME1 TIME2)))

(DEFSUBST TIME-DIFFERENCE (TIME1 TIME2)
  "Subtract one value of processor clock time [see (ZL:TIME)] from another,
or subtract an interval from a time.
Both time values are measured in 60'ths of a second.
This works correctly with clock wrap-around provided that
the time values are not too far apart or the interval is not too long.
DO NOT USE (ZL:TIME) for applications where that can matter."
  (LDB %%time-compare-byte-spec (%POINTER-DIFFERENCE TIME1 TIME2)))

(DEFSUBST TIME-INCREMENT (TIME INCREMENT)
  "Add an incremental (interval) value to value of processor clock time [see (ZL:TIME)].
Both the TIME and the INCREMENT are measured in 60'ths of a second.
This works correctly with wrap around provided times are not too far apart
or the interval is not too long.
DO NOT USE (ZL:TIME) for applications where that can matter."
  (LDB %%time-compare-byte-spec (%POINTER-PLUS TIME INCREMENT)))



))
