[rrd-users] --set-tz patch for rrdtool graph

Jason Fesler jfesler at gigo.com
Sat Mar 10 19:51:44 MET 2001


This patch will add a new argument to the "rrdtool graph" command
called "--set-tz".  It takes one argument - one of the form
PST8PDT or GMT, etc.   See "man environ" for how the TZ environment
variable works.

This patch was created, since setting  $ENV{"TZ"} in perl and then
using RRDs.pm was not adequate to affect rrdtool's sense of local time.

Blame can be sent to jfesler at gigo.com ..


*** rrdtool-1.0.28/src/rrd_graph.c      Wed Sep 13 23:04:00 2000
--- rrdtool-1.0.28jf/src/rrd_graph.c    Sat Mar 10 10:31:14 2001
***************
*** 2646,2651 ****
--- 2646,2658 ----
      return inp;
  }

+ void set_time_zone(char *s) {
+   char buf[256];
+   sprintf(buf,"TZ=%s",s);
+   putenv(buf);
+ }
+
+
  int
  rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize)
  {
***************
*** 2717,2722 ****
--- 2724,2730 ----
            {"alt-y-grid", no_argument,       0,   257 },
            {"alt-autoscale", no_argument,    0,   258 },
            {"alt-autoscale-max", no_argument,    0,   259 },
+           {"set-tz", required_argument,    0,   260 },
            {0,0,0,0}};
        int option_index = 0;
        int opt;
***************
*** 2730,2735 ****
--- 2738,2747 ----
            break;

        switch(opt) {
+       case 260:
+           /* "tz" */
+           set_time_zone(optarg);
+           break;
        case 257:
            im.extra_flags |= ALTYGRID;
            break;

-- 
Jason Fesler  <jfesler at gigo.com>
Good, Fast, Cheap -  Pick any two. - RFC 1925


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list