Suppress repeated prefixes in timestamps
Always printing the full timestamp makes the graph look cluttered. So we print only the first in full format and then only the part suffix that changed since the previous one. This gives us a nice major/minor pattern.
This commit is contained in:
parent
cdd9f6fdd8
commit
7fc7cb46a9
|
@ -616,11 +616,27 @@ sub get_ticks {
|
|||
$nexttime = sub { return $_[0] + 60 };
|
||||
}
|
||||
|
||||
my $time = $firsttime;
|
||||
my $time = $nexttime->($firsttime);
|
||||
my $llb;
|
||||
for (;;) {
|
||||
push @ticks, [$time, strftime($label, localtime($time))];
|
||||
my $lb = strftime($label, localtime($time));
|
||||
my $dlb = $lb;
|
||||
if ($llb) {
|
||||
my @lc = split(/(\d+)/, $llb);
|
||||
my @c = split(/(\d+)/, $lb);
|
||||
for my $i (0 .. $#c) {
|
||||
if ($c[$i] eq $lc[$i]) {
|
||||
$c[$i] = " " x length($c[$i]);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
$dlb = join("", @c);
|
||||
}
|
||||
push @ticks, [$time, $dlb];
|
||||
if ($time > $lasttime) {last}
|
||||
$time = $nexttime->($time);
|
||||
$llb = $lb;
|
||||
}
|
||||
|
||||
return @ticks;
|
||||
|
|
Loading…
Reference in New Issue