From 8db494f2b4b077759fe4a651fc3ac5096e03321a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 17 Dec 2010 19:59:36 +0100 Subject: vzds: Add -t (negative display start offset) --- bin/vzds | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/vzds b/bin/vzds index 94c052f..749c3ee 100755 --- a/bin/vzds +++ b/bin/vzds @@ -13,7 +13,7 @@ use Term::ANSIColor; my %opts; -getopts('a:cg', \%opts); +getopts('a:cgt:', \%opts); my $count = shift // 5; @@ -38,12 +38,15 @@ my $yellow = $im->colorAllocateAlpha(255, 255, 200, $alpha); my $red = $im->colorAllocateAlpha(255, 191, 191, $alpha); my $text; +my $start = time(); -getopts('cg', \%opts); +if ($opts{'t'}) { + $start -= $opts{'t'} * (3600 * 24 * 7); +} for my $i (1 .. $count) { - my @time = localtime(time + (3600 * 24 * $i)); + my @time = localtime($start + (3600 * 24 * $i)); my $day = strftime('%a', @time); my $mday = strftime('%d', @time); my $date = strftime('%m/%d', @time); -- cgit v1.2.3