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
1 use strict;
2
3 use Test::More tests => 2;
4 BEGIN { push @INC, '.' }
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
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);
22 }
23
24 1;