Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/Time-HiRes/Changes
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Revision history for the Perl extension Time::HiRes.
- don't try to suppress C++ compatibility warnings in C++ builds, since
that warns.
- Fix sleep's prototype to match CORE::sleep (;$).
- t/nanosleep.t: improve robustness on busy systems.

1.9764 [2020-08-10]
- Fix a bunch of repeated-word typos
Expand Down
2 changes: 1 addition & 1 deletion dist/Time-HiRes/HiRes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval
stat lstat utime
);

our $VERSION = '1.9780';
our $VERSION = '1.9781';
our $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;

Expand Down
22 changes: 17 additions & 5 deletions dist/Time-HiRes/t/nanosleep.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,23 @@ ok $one == $two || $two == $three

SKIP: {
skip "no gettimeofday", 2 unless &Time::HiRes::d_gettimeofday;
my $f = Time::HiRes::time();
Time::HiRes::nanosleep(500_000_000);
my $f2 = Time::HiRes::time();
my $d = $f2 - $f;
my $max_trials = 10;
my $trials = 0;
my $f;
my $f2;
my $d;
while ($trials++ < $max_trials) {
$f = Time::HiRes::time();
Time::HiRes::nanosleep(500_000_000);
$f2 = Time::HiRes::time();
$d = $f2 - $f;

# don't test the low-end, if this takes less than the low-end
# we have a real problem
last if $d < 0.9;

note "fail trial $trials/$max_trials d $d";
}
cmp_ok $d, '>', 0.4, "nanosleep for more than 0.4 sec";
skip "flapping test - more than 0.9 sec could be necessary...", 1 if $ENV{CI};
cmp_ok $d, '<', 0.9 or diag("# slept $d secs $f to $f2\n");
}
Loading