X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FTime%2FHiRes%2FHiRes.xs;h=9d3586dee8325d74b05d4474371f564e0f9e58b7;hb=6e3b076d535420d10e4d928a62445e7e7b46eef7;hp=49817414308f9e5e190db634856b3b83a822e2f0;hpb=cfb1f18ccca2d956de8b9ca71a575c4fa38c2b2f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/Time/HiRes/HiRes.xs b/ext/Time/HiRes/HiRes.xs index 4981741..9d3586d 100644 --- a/ext/Time/HiRes/HiRes.xs +++ b/ext/Time/HiRes/HiRes.xs @@ -9,6 +9,11 @@ extern "C" { #else #include #endif +#ifdef HAS_SELECT +# ifdef I_SYS_SELECT +# include +# endif +#endif #ifdef __cplusplus } #endif @@ -613,8 +618,9 @@ sleep(...) if (items > 0) { NV seconds = SvNV(ST(0)); if (seconds >= 0.0) { - UV useconds = 1E6 * (seconds - (UV)seconds); - sleep((UV)seconds); + UV useconds = (UV)(1E6 * (seconds - (UV)seconds)); + if (seconds >= 1.0) + sleep((UV)seconds); usleep(useconds); } else croak("Time::HiRes::sleep(%"NVgf"): negative time not invented yet", seconds);