From 9e81c95f3ef30967ea08f70a22bae2fe0031c901 Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 20 May 2003 20:51:04 +0000 Subject: [PATCH] I've made a patch to rrdcgi to add which allows you to re-format start and end-time at-style times using strftime. This allows easy timespans in the graph (e.g. -2weeks) to be formatted into more usual times. -- "Erskine, Thomas" git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@207 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/rrdcgi.pod | 11 ++++++++++- src/rrd_cgi.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/doc/rrdcgi.pod b/doc/rrdcgi.pod index 96008ad..cfa79a5 100644 --- a/doc/rrdcgi.pod +++ b/doc/rrdcgi.pod @@ -16,7 +16,7 @@ is to run as a cgi-program and parse a web page template containing special ERRD:: tags. B will interpret and act according to these tags. In the end it will printout a web page including the necessary CGI headers. -B parses the contents of the template in 2 steps. In each step it looks +B parses the contents of the template in 3 steps. In each step it looks only for a subset of tags. This allows to nest tags. The argument parser uses the same semantics as you are used from your c shell. @@ -96,6 +96,15 @@ time is I-formated with the string specified in the second argument. This gets replaced by the current time of day. The time is I-formated with the string specified in the argument. +=item RRD::TIME::STRFTIME I I I I + +This gets replaced by a strftime-formatted time using the format +I on either I or I depending on +whether I or I is specified. Both I and I +must be supplied as either could be relative to the other. This is intended +to allow pretty titles on graphs with times that are easier for non rrdtool +folks to figure out than "-2weeks". + =back =head2 Pass 3 diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c index 53c104f..a523706 100644 --- a/src/rrd_cgi.c +++ b/src/rrd_cgi.c @@ -56,6 +56,9 @@ char* includefile(long, char **); /* for how long is the output of the cgi valid ? */ char* rrdgoodfor(long, char **); +/* format at-time specified times using strftime */ +char* printstrftime(long, char**); + /** http protocol needs special format, and GMT time **/ char *http_time(time_t *); @@ -158,6 +161,7 @@ int main(int argc, char *argv[]) { i += parse(&buffer,i,"= 1) { -- 2.11.0