OSSP CVS Repository

ossp - Check-in [4931]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4931
Date: 2004-Dec-27 17:11:47 (local)
2004-Dec-27 16:11:47 (UTC)
User:rse
Branch:
Comment: print day lines at localtime, please
Tickets:
Inspections:
Files:
ossp-pkg/flow2rrd/flow2rrd.pl      1.13 -> 1.14     9 inserted, 4 deleted

ossp-pkg/flow2rrd/flow2rrd.pl 1.13 -> 1.14

--- flow2rrd.pl  2004/12/27 15:58:23     1.13
+++ flow2rrd.pl  2004/12/27 16:11:47     1.14
@@ -33,6 +33,7 @@
 use POSIX;             # from OpenPKG "perl"
 use IO::File;          # from OpenPKG "perl"
 use Getopt::Long;      # from OpenPKG "perl"
+use Time::Local;       # from OpenPKG "perl"
 use File::Temp;        # from OpenPKG "perl"
 use Data::Dumper;      # from OpenPKG "perl"
 use Date::Parse;       # from OpenPKG "perl-time"
@@ -568,11 +569,13 @@
             }
             my @draw = (@draw_o, 'COMMENT:\n', @draw_i);
             push(@draw, "HRULE:0#000000");
+            my $now = time();
+            my $tzoffset = $now - timelocal(gmtime($now));
             my $ts = int(($graph->{-graph_start} / (24*60*60)) + 0) * (24*60*60);
             my $te = int(($graph->{-graph_end}   / (24*60*60)) + 1) * (24*60*60);
             for (my $t = $ts; $t < $te; $t += (12*60*60)) {
-                if (($t % (24*60*60)) == 0) { push(@draw, "VRULE:$t#000000"); }
-                else                        { push(@draw, "VRULE:$t#999999"); }
+                if (($t % (24*60*60)) == 0) { push(@draw, sprintf("VRULE:%d#000000", $t - $tzoffset)); }
+                else                        { push(@draw, sprintf("VRULE:%d#999999", $t - $tzoffset)); }
             }
             my @args = ();
             push(@args, $graph->{-img_file});
@@ -654,11 +657,13 @@
             }
             my @draw = (@draw_o, 'COMMENT:\n', @draw_i);
             push(@draw, "HRULE:0#000000");
+            my $now = time();
+            my $tzoffset = $now - timelocal(gmtime($now));
             my $ts = int(($graph->{-graph_start} / (24*60*60)) + 0) * (24*60*60);
             my $te = int(($graph->{-graph_end}   / (24*60*60)) + 1) * (24*60*60);
             for (my $t = $ts; $t < $te; $t += (12*60*60)) {
-                if (($t % (24*60*60)) == 0) { push(@draw, "VRULE:$t#000000"); }
-                else                        { push(@draw, "VRULE:$t#999999"); }
+                if (($t % (24*60*60)) == 0) { push(@draw, sprintf("VRULE:%d#000000", $t - $tzoffset)); }
+                else                        { push(@draw, sprintf("VRULE:%d#999999", $t - $tzoffset)); }
             }
             my @args = ();
             push(@args, $graph->{-img_file});

CVSTrac 2.0.1