This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Watchdog re-queue
[perl5.git] / 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;