ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/t/01_timer.t
Revision: 1.2
Committed: Sat Nov 17 01:41:33 2007 UTC (16 years, 7 months ago) by root
Content type: application/x-troff
Branch: MAIN
Changes since 1.1: +4 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 BEGIN { $| = 1; print "1..3002\n"; }
2
3 use EV;
4
5 my $id = 1;
6 my @timer;
7
8 my $base = EV::now;
9 my $prev = EV::now;
10
11 for (1..1000) {
12 my $t = $_ * $_ * 1.735435336; $t -= int $t;
13 push @timer, EV::timer $t, 0, sub {
14 print EV::now >= $prev ? "" : "not ", "ok ", ++$id, " # a ", EV::now, " >= ", $prev, "\n";
15 print EV::now >= $base + $t ? "" : "not ", "ok ", ++$id, " # b ", EV::now, " >= ", $base + $t, "\n";
16
17 $prev = EV::now;
18
19 unless ($id % 3) {
20 $_[0]->set ($t * 0.0625);
21 $t *= 1.0625;
22 $_[0]->start;
23 }
24 };
25 }
26
27 print "ok 1\n";
28 EV::loop;
29 print "ok 3002\n";
30