]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fix bounds in rrd_xport
authorÓscar Nájera <on@mathias-kettner.de>
Mon, 18 Mar 2019 15:22:31 +0000 (16:22 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 19 Mar 2019 22:55:51 +0000 (23:55 +0100)
rrdxport needs to provide enough data points in its output for the
receiving client to be able to reproduce the graphs generated by rrdgraph.

- The start time pointer needs to be at the start of the interval that
  contain the query start time. For the function that retrieves the data.
  On output the returned start timestamp is > than query timestamp.
- SV export was missing the end boundary

src/rrd_xport.c

index 22193f6bd1e744a63fa15da1248f4703d1a6b3b4..0df0af55ca8683472b0c52b059e5b3bc6cfa0fab 100644 (file)
@@ -358,9 +358,6 @@ static int rrd_xport_fn(
     free(step_list);
 
     *start = im->start - im->start % (*step);
-    if (im->start > *start) {
-        *start = *start + *step;
-    }
 
     *end = im->end - im->end % (*step);
     if (im->end > *end) {
@@ -633,7 +630,7 @@ static int rrd_xport_format_sv(
     /* and now write the data */
     rrd_value_t *ptr = data;
 
-    for (time_t ti = start + step; ti < end; ti += step) {
+    for (time_t ti = start + step; ti <= end; ti += step) {
         /* write time */
         if (timefmt) {
             struct tm loc;