/[Time-Available]/t/test.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /t/test.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Fri Oct 3 15:23:48 2003 UTC (20 years, 7 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +15 -2 lines
File MIME type: application/x-troff
added fmt_interval function which pretty-print interval data

1 dpavlin 1.1 #!/usr/bin/perl
2    
3 dpavlin 1.2 use Test::Simple tests => 4;
4 dpavlin 1.1
5     use Time::Available qw(:days);
6    
7     my $i = Time::Available->new( start=>'07', end=>'17:15', dayMask=>DAY_WEEKDAY );
8     ok( defined($i) , 'new() work');
9    
10     ok( defined($i->{start}) && $i->{start} == 7*60*60, 'start time ok' );
11     ok( defined($i->{end}) && $i->{end} == ((17*60)+15)*60, 'end time ok' );
12    
13 dpavlin 1.2 my $t = 1 * 24; # 1d
14     $t += 11; # 11 hr
15     $t *= 60;
16     $t += 11; # 11 min
17     $t *= 60;
18     $t += 11; # 11 sec
19    
20     ok( Time::Available::fmt_interval($t) eq '1d 11:11:11', 'fmt_interval output ok');
21    
22     # 20000 = Thu Jan 1 06:33:20 1970
23     # 30000 = Thu Jan 1 09:20:00 1970
24     # 50000 = Thu Jan 1 14:53:20 1970
25     # 60000 = Thu Jan 1 17:40:00 1970
26     #print STDERR "uptime: ",$i->uptime(localtime),"\n";

  ViewVC Help
Powered by ViewVC 1.1.26