changeset 72283:a434e864f122

(kbd_buffer_get_event): Return Qnil when current time is exactly equal to end_time, not only when it is past that.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 05 Aug 2006 11:59:50 +0000
parents 296fad9dbeb0
children abe88643867b
files src/keyboard.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sat Aug 05 09:49:01 2006 +0000
+++ b/src/keyboard.c	Sat Aug 05 11:59:50 2006 +0000
@@ -3954,13 +3954,15 @@
 	{
 	  EMACS_TIME duration;
 	  EMACS_GET_TIME (duration);
-	  EMACS_SUB_TIME (duration, *end_time, duration);
-	  if (EMACS_TIME_NEG_P (duration))
-	    return Qnil;
+	  if (EMACS_TIME_GE (duration, *end_time))
+	    return Qnil;	/* finished waiting */
 	  else
-	    wait_reading_process_output (EMACS_SECS (duration),
-					 EMACS_USECS (duration), 
-					 -1, 1, Qnil, NULL, 0);
+	    {
+	      EMACS_SUB_TIME (duration, *end_time, duration);
+	      wait_reading_process_output (EMACS_SECS (duration),
+					   EMACS_USECS (duration),
+					   -1, 1, Qnil, NULL, 0);
+	    }
 	}
       else
 	wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);