ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/t/01_timer.t
Revision: 1.1
Committed: Tue Nov 13 02:43:26 2007 UTC (16 years, 7 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-0_9
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, "\n";
15 print EV::now >= $base + $t ? "" : "not ", "ok ", ++$id, "\n";
16
17 unless ($id % 3) {
18 $_[0]->set ($t * 0.0625);
19 $t *= 1.0625;
20 $_[0]->start;
21 }
22 };
23 }
24
25 print "ok 1\n";
26 EV::loop;
27 print "ok 3002\n";
28