diff --git a/TimeSeries.pm b/TimeSeries.pm index 68087b0..c70e9a0 100644 --- a/TimeSeries.pm +++ b/TimeSeries.pm @@ -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;