Commit | Line | Data |
---|---|---|
90e44bf6 Z |
1 | use strict; |
2 | ||
c4a535af | 3 | use Test::More tests => 2; |
465db51d | 4 | BEGIN { push @INC, '.' } |
90e44bf6 Z |
5 | use t::Watchdog; |
6 | ||
7 | BEGIN { require_ok "Time::HiRes"; } | |
8 | ||
9 | SKIP: { | |
10 | skip "no gettimeofday", 1 unless &Time::HiRes::d_gettimeofday; | |
11 | my ($s, $n, $i) = (0); | |
12 | for $i (1 .. 100) { | |
13 | $s += Time::HiRes::time() - CORE::time(); | |
14 | $n++; | |
15 | } | |
16 | # $s should be, at worst, equal to $n | |
17 | # (CORE::time() may be rounding down, up, or closest), | |
18 | # but allow 10% of slop. | |
19 | ok abs($s) / $n <= 1.10 | |
c4a535af SH |
20 | or print("# Time::HiRes::time() not close to CORE::time()\n"); |
21 | printf("# s = $s, n = $n, s/n = %s\n", abs($s)/$n); | |
90e44bf6 Z |
22 | } |
23 | ||
24 | 1; |