line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::CalendarMonth::DateTool::TimeLocal; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$HTML::CalendarMonth::DateTool::TimeLocal::VERSION = '1.26'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Interface to Time::Local |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
936
|
use strict; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
91
|
|
9
|
4
|
|
|
4
|
|
13
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
73
|
|
10
|
4
|
|
|
4
|
|
11
|
use Carp; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
172
|
|
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
14
|
use base qw( HTML::CalendarMonth::DateTool ); |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
234
|
|
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
12
|
use Time::Local; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
519
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub dow1st_and_lastday { |
17
|
921
|
|
|
921
|
1
|
874
|
my($self, $month, $year) = @_; |
18
|
921
|
|
33
|
|
|
2405
|
$month ||= $self->month; |
19
|
921
|
|
33
|
|
|
2063
|
$year ||= $self->year; |
20
|
|
|
|
|
|
|
# map month to 0-12 |
21
|
921
|
|
|
|
|
1038
|
--$month; |
22
|
|
|
|
|
|
|
# years since 1900...hooh-rah for POSIX... |
23
|
921
|
|
|
|
|
861
|
$year -= 1900; |
24
|
921
|
|
|
|
|
752
|
my $nmonth = $month + 1; |
25
|
921
|
|
|
|
|
690
|
my $nyear = $year; |
26
|
921
|
100
|
|
|
|
1395
|
if ($nmonth > 11) { |
27
|
|
|
|
|
|
|
# Happy new year |
28
|
78
|
|
|
|
|
67
|
$nmonth = 0; |
29
|
78
|
|
|
|
|
72
|
++$nyear; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
# Leave dow of 1st in 0-based format |
32
|
921
|
|
|
|
|
1884
|
my $dow1st = (gmtime(Time::Local::timegm(0,0,0,1,$month,$year)))[6]; |
33
|
|
|
|
|
|
|
# Last day is one day prior to 1st of month after |
34
|
921
|
|
|
|
|
19077
|
my $lastday = (gmtime(Time::Local::timegm(0,0,0,1,$nmonth,$nyear) |
35
|
|
|
|
|
|
|
- 60*60*24))[3]; |
36
|
921
|
|
|
|
|
14453
|
($dow1st, $lastday); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |