Date-Span

 view release on metacpan or  search on metacpan

lib/Date/Span.pm  view on Meta::CPAN

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
                (1 .. ($end_date - $start_date - 86400) / 86400)
                if ($end_date - $start_date > 86400);
 
        push @results, [ $end_date, $end_time ] if $start_date != $end_date;
 
        return @results;
}
 
#pod =func range_expand
#pod
#pod   my @endpoint_pairs = range_expand($start, $end);
#pod
#pod Given C<$start> and C<$end> as timestamps (in epoch seconds),
#pod C<range_durations> returns a list of arrayrefs.  Each arrayref is a start and
#pod end timestamp.  No pair of start and end times will cross a date boundary, and
#pod the set of ranges as a whole will be identical to the passed start and end.
#pod
#pod =cut
 
sub range_expand {
        my ($start, $end) = @_;

lib/Date/Span.pm  view on Meta::CPAN

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
  my @durations = range_durations($start, $end)
 
Given C<$start> and C<$end> as timestamps (in epoch seconds),
C<range_durations> returns a list of arrayrefs.  Each arrayref is a date
(expressed as epoch seconds at midnight) and the number of seconds for which
the given range intersects with the date.
 
=head2 range_expand
 
  my @endpoint_pairs = range_expand($start, $end);
 
Given C<$start> and C<$end> as timestamps (in epoch seconds),
C<range_durations> returns a list of arrayrefs.  Each arrayref is a start and
end timestamp.  No pair of start and end times will cross a date boundary, and
the set of ranges as a whole will be identical to the passed start and end.
 
=head2 range_from_unit
 
  my ($start, $end) = range_from_unit(@date_unit)



( run in 0.348 second using v1.01-cache-2.11-cpan-e9199f4ba4c )