line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of Language::Befunge. |
3
|
|
|
|
|
|
|
# Copyright (c) 2001-2009 Jerome Quelin, all rights reserved. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
6
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Language::Befunge::lib::TIME; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
4852
|
use 5.010; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
50
|
|
13
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
14
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
3426
|
use DateTime; |
|
1
|
|
|
|
|
300485
|
|
|
1
|
|
|
|
|
8
|
|
17
|
0
|
|
|
0
|
1
|
|
sub new { return bless {}, shift; } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub D { |
21
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
22
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
23
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
24
|
0
|
|
|
|
|
|
$ip->spush( $dt->day ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub F { |
28
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
29
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
30
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
31
|
0
|
|
|
|
|
|
$ip->spush( $dt->day_of_year ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub G { |
35
|
0
|
|
|
0
|
1
|
|
my (undef, $interp) = @_; |
36
|
0
|
|
|
|
|
|
$interp->get_curip->extdata('TIME', 'UTC'); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub H { |
40
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
41
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
42
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
43
|
0
|
|
|
|
|
|
$ip->spush( $dt->hour ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub L { |
47
|
0
|
|
|
0
|
1
|
|
my (undef, $interp) = @_; |
48
|
0
|
|
|
|
|
|
$interp->get_curip->extdata('TIME', 'local'); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub M { |
53
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
54
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
55
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
56
|
0
|
|
|
|
|
|
$ip->spush( $dt->minute ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub O { |
60
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
61
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
62
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
63
|
0
|
|
|
|
|
|
$ip->spush( $dt->month ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub S { |
67
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
68
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
69
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
70
|
0
|
|
|
|
|
|
$ip->spush( $dt->second ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub W { |
74
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
75
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
76
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
77
|
0
|
|
|
|
|
|
$ip->spush( $dt->day_of_week + 1 ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub Y { |
81
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
82
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip; |
83
|
0
|
|
|
|
|
|
my $dt = DateTime->now( time_zone => _tz($interp) ); |
84
|
0
|
|
|
|
|
|
$ip->spush( $dt->year ); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _tz { |
88
|
0
|
|
|
0
|
|
|
my $interp = shift; |
89
|
0
|
|
0
|
|
|
|
return $interp->get_curip->extdata('TIME') // 'local'; # // FIXME: padre syntax highlight |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |