line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Time::Random; |
2
|
3
|
|
|
3
|
|
184840
|
use 5.006; use strict; use warnings; our $VERSION = '0.06'; |
|
3
|
|
|
3
|
|
52
|
|
|
3
|
|
|
3
|
|
13
|
|
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
59
|
|
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
135
|
|
3
|
3
|
|
|
3
|
|
1333
|
use Time::Piece; |
|
3
|
|
|
|
|
34835
|
|
|
3
|
|
|
|
|
11
|
|
4
|
3
|
|
|
3
|
|
203
|
use base 'Import::Export'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1143
|
|
5
|
|
|
|
|
|
|
our %EX = ( |
6
|
|
|
|
|
|
|
time_random => [qw/all/], |
7
|
|
|
|
|
|
|
); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub time_random { |
10
|
106
|
100
|
|
106
|
1
|
46860
|
my %args = scalar @_ == 1 ? %{ $_[0] } : @_; |
|
2
|
|
|
|
|
7
|
|
11
|
|
|
|
|
|
|
$args{$_} = $args{$_} |
12
|
|
|
|
|
|
|
? $args{strptime} |
13
|
|
|
|
|
|
|
? Time::Piece->strptime($args{$_}, $args{strptime})->epoch |
14
|
|
|
|
|
|
|
: ref $args{$_} |
15
|
|
|
|
|
|
|
? $args{$_}->epoch() |
16
|
|
|
|
|
|
|
: $args{$_} |
17
|
|
|
|
|
|
|
: $_ eq 'to' ? time : ($args{to} - int(rand(86400))) |
18
|
106
|
100
|
|
|
|
534
|
foreach qw/to from/; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
19
|
106
|
|
|
|
|
584
|
$args{time} = gmtime($args{to} - int(rand($args{to} - $args{from}))); |
20
|
106
|
100
|
|
|
|
4583
|
$args{strftime} ? $args{time}->strftime($args{strftime}) : $args{time}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |