Watchdog re-queue
Jerry D. Hedden [Tue, 9 Sep 2008 09:54:41 +0000 (05:54 -0400)]
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510809090654v2de48f1r37499d573f452cdb@mail.gmail.com>
Date: Tue, 9 Sep 2008 09:54:41 -0400

p4raw-id: //depot/perl@34337

t/test.pl

index 8b3154e..f44e43c 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -909,12 +909,10 @@ sub watchdog ($)
                 eval { require POSIX; };
 
                 # Execute the timeout
-                my $time_elapsed = 0;
                 my $time_left = $timeout;
-                while ($time_elapsed < $timeout) { 
-                    $time_elapsed += sleep($time_left);
-                    $time_left = $timeout - $time_elapsed;
-                }
+                do {
+                    $time_left -= sleep($time_left);
+                } while ($time_left > 0);
 
                 # Kill the parent (and ourself)
                 select(STDERR); $| = 1;