X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FVPIT%2FTestHelpers.pm;h=476ce9ba92e837164e5f775ac308ff2e205304e5;hb=3ba261a525c267b0abe70503c79eaee1389e2aba;hp=bdc3a4c465d3e8bc7c1f0cf2898beb3b901dd670;hpb=7f0ff09635ac5356801d548bb603970e45d53511;p=perl%2Fmodules%2FVPIT-TestHelpers.git diff --git a/lib/VPIT/TestHelpers.pm b/lib/VPIT/TestHelpers.pm index bdc3a4c..476ce9b 100644 --- a/lib/VPIT/TestHelpers.pm +++ b/lib/VPIT/TestHelpers.pm @@ -680,7 +680,7 @@ where : =item - -C<@impls> is the list of desired implementations (which may be C<'Time::HiRes'> or C<'sleep'>), in the order they should be checked. +C<@impls> is the list of desired implementations (which may be C<'Time::HiRes'>, C<'select'> or C<'sleep'>), in the order they should be checked. When the list is empty, it defaults to all of them. =back @@ -740,8 +740,9 @@ sub init_usleep { 'sleep' => sub { diag 'Using sleep()-based fallback usleep()'; return sub ($) { - my $s = int($_[0] / 1e6); - my $t = sleep $s; + my $ms = int $_[0]; + my $s = int($ms / 1e6) + ($ms % 1e6 == 0 ? 0 : 1); + my $t = sleep $s; return $t * 1e6; }; },