X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftime.lisp;h=ddc8cbc9437cd6496f042e6eacfb1ff3d13ccc49;hb=eb4a67799308fc2e610ca330401c9cb07533143c;hp=72abe2123353fbc596fb975d62394f97b754b687;hpb=881c3a215e3a82faf928265f8606f940f3e44e1e;p=sbcl.git diff --git a/src/code/time.lisp b/src/code/time.lisp index 72abe21..ddc8cbc 100644 --- a/src/code/time.lisp +++ b/src/code/time.lisp @@ -36,11 +36,9 @@ micro-seconds-per-internal-time-unit))) (declare (type (unsigned-byte 32) uint)) (cond (base - (truly-the (unsigned-byte 32) - (+ (the (unsigned-byte 32) - (* (the (unsigned-byte 32) (- seconds base)) - sb!xc:internal-time-units-per-second)) - uint))) + (+ (* (- seconds base) + sb!xc:internal-time-units-per-second) + uint)) (t (setq *internal-real-time-base-seconds* seconds) uint))))) @@ -49,7 +47,6 @@ #!+sb-doc "Return the run time in the internal time format. (See INTERNAL-TIME-UNITS-PER-SECOND.) This is useful for finding CPU usage." - (declare (values (unsigned-byte 32))) (multiple-value-bind (ignore utime-sec utime-usec stime-sec stime-usec) (sb!unix:unix-fast-getrusage sb!unix:rusage_self) (declare (ignore ignore) @@ -59,9 +56,8 @@ ;; documented anywhere and the observed behavior is to ;; sometimes return 1000000 exactly.) (type (integer 0 1000000) utime-usec stime-usec)) - (let ((result (+ (the (unsigned-byte 32) - (* (the (unsigned-byte 32) (+ utime-sec stime-sec)) - sb!xc:internal-time-units-per-second)) + (let ((result (+ (* (+ utime-sec stime-sec) + sb!xc:internal-time-units-per-second) (floor (+ utime-usec stime-usec (floor micro-seconds-per-internal-time-unit 2)) @@ -176,14 +172,14 @@ (cond ((< unix-time (- (ash 1 31))) (multiple-value-bind (year offset) (years-since-mar-2000 utime) - (declare (ignore year)) - (+ +mar-1-1903+ (- unix-to-universal-time) offset))) + (declare (ignore year)) + (+ +mar-1-1903+ (- unix-to-universal-time) offset))) ((>= unix-time (ash 1 31)) (multiple-value-bind (year offset) (years-since-mar-2000 utime) - (declare (ignore year)) - (+ +mar-1-2035+ (- unix-to-universal-time) offset))) + (declare (ignore year)) + (+ +mar-1-2035+ (- unix-to-universal-time) offset))) (t unix-time)))) - + (defun decode-universal-time (universal-time &optional time-zone) #!+sb-doc "Converts a universal-time to decoded time format returning the following @@ -266,10 +262,10 @@ (type (integer 1 31) date) (type (integer 1 12) month) (type (or (integer 0 99) (integer 1899)) year) - ;; that type used to say (integer 1900), but that's - ;; incorrect when a time-zone is specified: we should be - ;; able to encode to produce 0 when a non-zero timezone is - ;; specified - bem, 2005-08-09 + ;; that type used to say (integer 1900), but that's + ;; incorrect when a time-zone is specified: we should be + ;; able to encode to produce 0 when a non-zero timezone is + ;; specified - bem, 2005-08-09 (type (or null rational) time-zone)) (let* ((year (if (< year 100) (pick-obvious-year year) @@ -281,7 +277,7 @@ (leap-years-before year)) (* (- year 1900) 365))) (hours (+ hour (* days 24))) - (encoded-time 0)) + (encoded-time 0)) (if time-zone (setf encoded-time (+ second (* (+ minute (* (+ hours time-zone) 60)) 60))) (let* ((secwest-guess