From: Paul Green Date: Fri, 29 Mar 2002 00:05:00 +0000 (-0500) Subject: optimize ext/Time/HiRes/HiRes.xs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4880edd6031a95381946ccf1b47bbb13704bb574;p=p5sagit%2Fp5-mst-13.2.git optimize ext/Time/HiRes/HiRes.xs Message-Id: <200203290506.AAA20433@mailhub1.stratus.com> p4raw-id: //depot/perl@15593 --- diff --git a/ext/Time/HiRes/HiRes.xs b/ext/Time/HiRes/HiRes.xs index 4f85f3b..5292231 100644 --- a/ext/Time/HiRes/HiRes.xs +++ b/ext/Time/HiRes/HiRes.xs @@ -618,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 = 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);