Added 15 minute tick for times < 1h.
This commit is contained in:
parent
6833d0b350
commit
b7cba90cc7
|
@ -33,7 +33,7 @@ use HTTP::Date qw(parse_date);
|
||||||
use Time::Local qw(timegm_nocheck);
|
use Time::Local qw(timegm_nocheck);
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
|
||||||
our $VERSION = do { my @r=(q$Revision: 1.17 $=~/\d+/g);sprintf "%d."."%02d"x$#r,@r};
|
our $VERSION = do { my @r=(q$Revision: 1.18 $=~/\d+/g);sprintf "%d."."%02d"x$#r,@r};
|
||||||
|
|
||||||
=head2 new(%opts)
|
=head2 new(%opts)
|
||||||
|
|
||||||
|
@ -513,10 +513,17 @@ sub get_ticks {
|
||||||
$label = '%Y-%m-%d %H:%M';
|
$label = '%Y-%m-%d %H:%M';
|
||||||
|
|
||||||
$nexttime = sub { return $_[0] + 3600 };
|
$nexttime = sub { return $_[0] + 3600 };
|
||||||
|
} elsif ($lasttime - $firsttime > 1 * 3600) {
|
||||||
|
# 1 to 6 hours: 1 tick per 15 minutes.
|
||||||
|
|
||||||
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($firsttime);
|
||||||
|
$sec = 0;
|
||||||
|
$min = int($min / 15) * 15;
|
||||||
|
$firsttime = timelocal($sec,$min,$hour,$mday,$mon,$year);
|
||||||
|
$label = '%Y-%m-%d %H:%M';
|
||||||
|
$nexttime = sub { return $_[0] + 15 * 60 };
|
||||||
} else {
|
} else {
|
||||||
# less than 6 hours: 1 tick per minute.
|
# less than 1 hour: 1 tick per minute.
|
||||||
# (ok, that's too much - need to find some intermediate steps,
|
|
||||||
# but for now I need graphs over a few minutes.
|
|
||||||
|
|
||||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($firsttime);
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($firsttime);
|
||||||
$sec = 0;
|
$sec = 0;
|
||||||
|
|
Loading…
Reference in New Issue