From: oetiker Date: Tue, 20 May 2003 20:51:04 +0000 (+0000) Subject: I've made a patch to rrdcgi to add which allows X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ec130c637efacb3acf15ef8734d0da16374e6450;p=rrdtool-all.git 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@207 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/doc/rrdcgi.pod b/program/doc/rrdcgi.pod index 96008ade..cfa79a51 100644 --- a/program/doc/rrdcgi.pod +++ b/program/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/program/src/rrd_cgi.c b/program/src/rrd_cgi.c index 53c104f0..a5237067 100644 --- a/program/src/rrd_cgi.c +++ b/program/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) {