From 4e757f9643779912c99c1c500d9e243b6d14e369 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Wed, 9 Sep 1992 17:45:14 +0000
Subject: [PATCH] Fixed WAIT-UNTIL-FD-USABLE to correctly borrow from the
 timeout seconds when computing the new value for the timeout microseconds and
 it is negative.

---
 code/serve-event.lisp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/code/serve-event.lisp b/code/serve-event.lisp
index 1bec1aa73..e130ac1ef 100644
--- a/code/serve-event.lisp
+++ b/code/serve-event.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/serve-event.lisp,v 1.16 1992/07/17 18:16:26 ram Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/serve-event.lisp,v 1.17 1992/09/09 17:45:14 ram Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -317,7 +317,11 @@
 			  (and (= sec stop-sec) (>= usec stop-usec)))
 		  (return nil))
 		(setq to-sec (- stop-sec sec))
-		(setq to-usec (- stop-usec usec))))))))))
+		(cond ((> usec stop-usec)
+		       (decf to-sec)
+		       (setq to-usec (- (+ stop-usec 1000000) usec)))
+		      (t
+		       (setq to-usec (- stop-usec usec))))))))))))
 
 
 (defvar *display-event-handlers* nil
-- 
GitLab