summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-12-17 19:59:36 +0100
committerDaniel Friesel <derf@finalrewind.org>2010-12-17 19:59:36 +0100
commit8db494f2b4b077759fe4a651fc3ac5096e03321a (patch)
tree6e528d61b3850cddb72a3086fa5bc71b40f61e24 /bin
parentb5124f2d4b990d1f1a1682d3825d5285bb912c42 (diff)
vzds: Add -t (negative display start offset)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/vzds9
1 files changed, 6 insertions, 3 deletions
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);