The type error happens in function GET-INTERNAL-REAL-TIME
The value of 'now' variable is declared as unsigned-byte (which according to CLHS I think this is appropriate),
but when calculating its new value, the result from subtracting seconds might be negative one. (if setting the system time to the past).
I create a patch of this fix.
Thanks for the review and advice. :)
From 84a1161018bec29e50bca2806fdc35be93fe8249 Mon Sep 17 00:00:00 2001
From: Nixie <email address hidden>
Date: Fri, 27 Jul 2012 07:11:11 +0800
Subject: [PATCH] Rejuvenate the internal real time in case we return to the past
The type error happens in function GET-INTERNAL- REAL-TIME
The value of 'now' variable is declared as unsigned-byte (which according to CLHS I think this is appropriate),
but when calculating its new value, the result from subtracting seconds might be negative one. (if setting the system time to the past).
I create a patch of this fix.
Thanks for the review and advice. :)
From 84a1161018bec29 e50bca2806fdc35 be93fe8249 Mon Sep 17 00:00:00 2001
From: Nixie <email address hidden>
Date: Fri, 27 Jul 2012 07:11:11 +0800
Subject: [PATCH] Rejuvenate the internal real time in case we return to the past
Fixes lp#1028026
---
src/code/unix.lisp | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/code/ unix.lisp b/src/code/ unix.lisp unix.lisp unix.lisp real-time ()
(multiple- value-bind (sec msec) (system- real-time- values) time-units- per-second) internal- real-time) time-units- per-second)
index 7a1a628..fbc679a 100644
--- a/src/code/
+++ b/src/code/
@@ -1174,13 +1174,17 @@ the UNIX epoch (January 1st 1970.)"
;; --MG
(defun get-internal-
- (unless (and (= msec c-msec) (= sec c-sec))
- (setf now (+ (* (- sec e-sec)
- sb!xc:internal-
- (- msec e-msec))
- c-msec msec
- c-sec sec))
- now)))
+ (if (or (< sec e-sec)
+ (and (= sec e-sec) (< msec e-msec)))
+ (progn (reinit-
+ (setf now 0))
+ (unless (and (= msec c-msec) (= sec c-sec))
+ (setf now (+ (* (- sec e-sec)
+ sb!xc:internal-
+ (- msec e-msec))
+ c-msec msec
+ c-sec sec)))
+ now)))
(defun system- internal- run-time () value-bind (ignore utime-sec utime-usec stime-sec stime-usec)
(multiple-
--
1.7.3.4