Merge branch 'master' of git.hjp.at:hjp/timeseries

This commit is contained in:
Peter J. Holzer 2020-02-16 10:51:53 +01:00
commit 0d47dee3cd
1 changed files with 18 additions and 2 deletions

View File

@ -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;