This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix dist/Time-HiRes/t/*.t that assumed '.' in @INC
[perl5.git] / dist / Time-HiRes / t / time.t
CommitLineData
90e44bf6
Z
1use strict;
2
c4a535af 3use Test::More tests => 2;
465db51d 4BEGIN { push @INC, '.' }
90e44bf6
Z
5use t::Watchdog;
6
7BEGIN { require_ok "Time::HiRes"; }
8
9SKIP: {
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
241;