[memcached] bradfitz, r390: work even if no Time::HiRes
commits at code.sixapart.com
commits at code.sixapart.com
Sat Sep 9 20:25:36 UTC 2006
work even if no Time::HiRes
U trunk/server/t/expirations.t
Modified: trunk/server/t/expirations.t
===================================================================
--- trunk/server/t/expirations.t 2006-09-09 20:25:18 UTC (rev 389)
+++ trunk/server/t/expirations.t 2006-09-09 20:25:35 UTC (rev 390)
@@ -11,10 +11,14 @@
my $expire;
sub wait_for_early_second {
- use Time::HiRes ();
- my $tsh = Time::HiRes::time();
- my $ts = int($tsh); # in case time was overloaded to be hires.
- return if ($tsh - $ts) < 0.5;
+ my $have_hires = eval "use Time::HiRes (); 1";
+ if ($have_hires) {
+ my $tsh = Time::HiRes::time();
+ my $ts = int($tsh);
+ return if ($tsh - $ts) < 0.5;
+ }
+
+ my $ts = int(time());
while (1) {
my $t = int(time());
return if $t != $ts;
More information about the memcached-commits
mailing list