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