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
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;