From: Jean-Yves Avenard Date: Thu, 17 Jan 2013 18:20:36 +0000 (+1100) Subject: Add --utc to graph option. X-Git-Tag: v1.8.0~38^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1088%2Fhead;p=thirdparty%2Frrdtool-1.x.git Add --utc to graph option. Allow to generate a graph as if the current timezone was UTC (e.g set TZ=UTC). This allows to easily calculate daily average ranging from midgnight to midnight rather than say the last 24 hours. --- diff --git a/bindings/python/rrdtoolmodule.c b/bindings/python/rrdtoolmodule.c index f0205820..1ab46358 100644 --- a/bindings/python/rrdtoolmodule.c +++ b/bindings/python/rrdtoolmodule.c @@ -582,6 +582,7 @@ static char _rrdtool_graph__doc__[] = "Create a graph based on one or more " \ [-b|--base value]\n\ [-W|--watermark string]\n\ [-Z|--use-nan-for-all-missing-data]\n\ + [--utc]\n\ DEF:vname=rrdfile:ds-name:CF[:step=step][:start=time][:end=time]\n\ CDEF:vname=RPN expression\n\ VDEF=vname:RPN expression\n\n\ @@ -1094,7 +1095,7 @@ _rrdtool_lastupdate(PyObject *Py_UNUSED(self), PyObject *args) } PyDict_SetItemString(ds_dict, ds_names[i], val); - + if (val != Py_None) Py_DECREF(val); @@ -1204,7 +1205,7 @@ _rrdtool_fetch_cb_wrapper( rrd_set_error("expected 'start' key in callback return value to be " "of type int"); goto gil_release_err; - } else if (PyObject_RichCompareBool(tmp, tmp_min_ts, Py_EQ) || + } else if (PyObject_RichCompareBool(tmp, tmp_min_ts, Py_EQ) || PyObject_RichCompareBool(tmp, po_start, Py_LT)) { rrd_set_error("expected 'start' value in callback return dict to be " "equal or earlier than passed start timestamp"); diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod index 71ee3d85..ad13726f 100644 --- a/doc/rrdgraph.pod +++ b/doc/rrdgraph.pod @@ -562,6 +562,11 @@ If one DS is missing, either because the RRD is not available or because it does not contain the requested DS name, just assume that we got empty values instead of raising a fatal error. +[B<--utc>] + +Force the timezone to be UTC. Equivalent to doing TZ=UTC rrdtool graph .... +This is useful to calculate daily average ranging from midnight to midnight rather than say the last 24 hours. + =head2 Data and variables BIB<=>IB<:>IB<:>I[B<:step=>I][B<:start=>I