(FILECREATED " 5-Mar-84 15:50:58" {PHYLUM}<LISP>SOURCES>DATEPATCH.;1 2056   

      changes to:  (VARS DATEPATCHCOMS))


(* Copyright (c) 1984 by Xerox Corporation)

(PRETTYCOMPRINT DATEPATCHCOMS)

(RPAQQ DATEPATCHCOMS ((FNS \PACKDATE)
		      (LOCALVARS . T)))
(DEFINEQ

(\PACKDATE
  [LAMBDA (YR MONTH DAY HR MIN SEC)                          (* bvm: "25-Jan-84 11:48")
                                                             (* Packs indicated date into a single integer in Lisp 
							     date format. Returns NIL on errors.)
    (PROG (YDAY DAYSSINCEDAY0)
          (COND
	    ((NOT (AND YR MONTH DAY HR MIN SEC (IGREATERP YR 1900)))
	      (RETURN)))
          (RETURN
	    (ALTO.TO.LISP.DATE
	      (IPLUS
		SEC
		(LLSH
		  [ITIMES
		    30
		    (IPLUS MIN
			   (ITIMES 60
				   (IPLUS HR \TimeZoneComp
					  [ITIMES 24
						  (SETQ DAYSSINCEDAY0
						    (IPLUS (SETQ YDAY
							     (IPLUS (COND
								      ((AND (IGREATERP MONTH 1)
									    (ZEROP (IREMAINDER YR 4)))
                                                             (* After Feb 28 of a leap year)
									1)
								      (T 0))
								    (SELECTQ MONTH
									     (0 0)
									     (1 31)
									     (2 59)
									     (3 90)
									     (4 120)
									     (5 151)
									     (6 181)
									     (7 212)
									     (8 243)
									     (9 273)
									     (10 304)
									     (11 334)
									     NIL)
								    (SUB1 DAY)))
							   (ITIMES 365 (SETQ YR (IDIFFERENCE YR 1901))
								   )
							   (IQUOTIENT YR 4]
					  (COND
					    ((AND \DayLightSavings (\ISDST? YDAY HR
									    (IREMAINDER (IPLUS 
										    DAYSSINCEDAY0 1)
											7)))

          (* Subtract one to go from daylight to standard time. This time we computed weekday based on day 0 = Jan 1, 1901, 
	  which was a Tuesday = 1)


					      -1)
					    (T 0]
		  1])
)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(LOCALVARS . T)
)
(PUTPROPS DATEPATCH COPYRIGHT ("Xerox Corporation" 1984))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (270 1923 (\PACKDATE 280 . 1921)))))
STOP