Revision: | 1.6 |
Committed: | Thu Nov 22 04:52:24 2007 UTC (16 years, 8 months ago) by root |
Content type: | application/x-troff |
Branch: | MAIN |
CVS Tags: | rel-2_01, rel-2_0, rel-3_31, rel-3_33, rel-1_71, rel-3_4, rel-3_3, rel-3_2, rel-3_1, rel-3_0, rel-1_85, rel-1_8, rel-1_72, rel-1_3, rel-1_2, rel-1_5, rel-1_4, rel-1_6, rel-3_41, rel-1_81, rel-1_86 |
Changes since 1.5: | +4 -2 lines |
Log Message: | *** empty log message *** |
# | Content |
---|---|
1 | BEGIN { $| = 1; print "1..6002\n"; } |
2 | |
3 | no warnings; |
4 | use strict; |
5 | |
6 | use EV; |
7 | |
8 | my $fudge = 0.02; # allow rt and monotonic clock to disagree by this much |
9 | |
10 | my $id = 1; |
11 | my @timer; |
12 | my @periodic; |
13 | |
14 | my $base = EV::now; |
15 | my $prev = EV::now; |
16 | |
17 | for my $i (1..1000) { |
18 | my $t = $i * $i * 1.735435336; $t -= int $t; |
19 | push @timer, EV::timer $t, 0, sub { |
20 | my $now = EV::now; |
21 | |
22 | print $now + $fudge >= $prev ? "" : "not ", "ok ", ++$id, " # t0 $i $now + $fudge >= $prev\n"; |
23 | print $now + $fudge >= $base + $t ? "" : "not ", "ok ", ++$id, " # t1 $i $now + $fudge >= $base + $t\n"; |
24 | |
25 | unless ($id % 3) { |
26 | $t *= 0.0625; |
27 | $_[0]->set ($t); |
28 | $_[0]->start; |
29 | $t = $now + $t - $base; |
30 | } |
31 | |
32 | $prev = $now; |
33 | }; |
34 | |
35 | my $t = $i * $i * 1.375475771; $t -= int $t; |
36 | push @periodic, EV::periodic $base + $t, 0, 0, sub { |
37 | my $now = EV::now; |
38 | |
39 | print $now >= $prev ? "" : "not ", "ok ", ++$id, " # p0 $i $now >= $prev\n"; |
40 | print $now >= $base + $t ? "" : "not ", "ok ", ++$id, " # p1 $i $now >= $base + $t\n"; |
41 | |
42 | unless ($id % 3) { |
43 | $t *= 1.0625; |
44 | $_[0]->set ($base + $t); |
45 | $_[0]->start; |
46 | } |
47 | |
48 | $prev = $now; |
49 | }; |
50 | } |
51 | |
52 | print "ok 1\n"; |
53 | EV::loop; |
54 | print "ok 6002\n"; |
55 |