tests: use native Sleep function as fallback on Windows

Reviewed-By: Daniel Stenberg
Closes #5054
This commit is contained in:
Marc Hoersken 2020-03-07 11:01:57 +01:00
parent 99c688ba21
commit a6fed41f6f
No known key found for this signature in database
GPG Key ID: 61E03CBED7BC859E
1 changed files with 7 additions and 2 deletions

View File

@ -25,6 +25,11 @@ BEGIN {
eval {
no warnings "all";
require Time::HiRes;
};
# portable sleeping falls back to native Sleep on Win32
eval {
no warnings "all";
require Win32;
}
}
@ -50,8 +55,8 @@ sub portable_sleep {
if($Time::HiRes::VERSION) {
Time::HiRes::sleep($seconds);
}
elsif ($seconds > 1 && ($^O eq 'MSWin32' || $^O eq 'msys')) {
sleep($seconds);
elsif ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') {
Win32::Sleep($seconds*1000);
}
else {
select(undef, undef, undef, $seconds);