]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
1999-10-19 Bruno Haible <haible@ilog.fr>
authorRoland McGrath <roland@gnu.org>
Tue, 19 Oct 1999 17:53:26 +0000 (17:53 +0000)
committerRoland McGrath <roland@gnu.org>
Tue, 19 Oct 1999 17:53:26 +0000 (17:53 +0000)
        * sysdeps/mach/sleep.c (__sleep): If we slept longer than requested,
return 0, not UINT_MAX.

sysdeps/mach/sleep.c

index 7d044129685d8f404086dacb2fcf49c87cf632c6..7088b43d96ba4a8674aea12abb2be56547bf7b7e 100644 (file)
@@ -31,6 +31,7 @@ __sleep (unsigned int seconds)
 {
   time_t before, after;
   mach_port_t recv;
+  unsigned int slept;
 
   recv = __mach_reply_port ();
 
@@ -40,6 +41,7 @@ __sleep (unsigned int seconds)
   after = time ((time_t *) NULL);
   __mach_port_destroy (__mach_task_self (), recv);
 
-  return seconds - (after - before);
+  slept = after - before;
+  return (slept <= seconds ? seconds - slept : 0);
 }
 weak_alias (__sleep, sleep)