Add new grid spacing for less than 6 hours.
This commit is contained in:
parent
22da4bd59d
commit
99f7bdff4a
|
@ -27,7 +27,7 @@ use Data::Dumper;
|
|||
use HTTP::Date qw(parse_date);
|
||||
use Time::Local qw(timegm_nocheck);
|
||||
|
||||
$VERSION = do { my @r=(q$Revision: 1.14 $=~/\d+/g);sprintf "%d."."%02d"x$#r,@r};
|
||||
$VERSION = do { my @r=(q$Revision: 1.15 $=~/\d+/g);sprintf "%d."."%02d"x$#r,@r};
|
||||
|
||||
=head2 new(%opts)
|
||||
|
||||
|
@ -487,8 +487,8 @@ sub plot {
|
|||
}
|
||||
$lasttime = $time;
|
||||
print $ctlfh ")\n";
|
||||
} else {
|
||||
# less than 2 days: 1 tick per hour.
|
||||
} elsif ($lasttime - $firsttime > 6 * 3600) {
|
||||
# 6 hours to 2 days: 1 tick per hour.
|
||||
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($firsttime);
|
||||
$sec = $min = 0;
|
||||
|
@ -509,6 +509,30 @@ sub plot {
|
|||
}
|
||||
$lasttime = $time;
|
||||
print $ctlfh ")\n";
|
||||
} else {
|
||||
# less than 6 hours: 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);
|
||||
$sec = 0;
|
||||
my $time = $firsttime = timelocal($sec,$min,$hour,$mday,$mon,$year);
|
||||
print $ctlfh "set xtics rotate (";
|
||||
my $comma = 0;
|
||||
for (;;) {
|
||||
($sec,$min,$hour,$mday,$mon,$year) = localtime($time);
|
||||
if ($comma) {
|
||||
print $ctlfh ", ";
|
||||
} else {
|
||||
$comma = 1;
|
||||
}
|
||||
printf $ctlfh qq|"%04d-%02d-%02d %02d:%02d" %d|, $year+1900, $mon+1, $mday, $hour, $min, $time;
|
||||
if ($time > $lasttime) {last}
|
||||
|
||||
$time += 60;
|
||||
}
|
||||
$lasttime = $time;
|
||||
print $ctlfh ")\n";
|
||||
}
|
||||
|
||||
# what to plot
|
||||
|
|
Loading…
Reference in New Issue