From 832331010974c7899ad3c3124557a12c48b7e2c5 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sat, 31 May 2008 12:28:11 +0000 Subject: [PATCH] make sure vdef calcs only calc as far as originally requested. git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1386 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 480041f9..760e3a34 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -4510,15 +4510,18 @@ int vdef_calc( graph_desc_t *src, *dst; rrd_value_t *data; long step, steps; + unsigned long end; dst = &im->gdes[gdi]; src = &im->gdes[dst->vidx]; data = src->data + src->ds; - steps = (src->end - src->start) / src->step; + end = src->end_orig % src->step == 0 ? src->end_orig : (src->end_orig + src->step - src->end_orig % src->step); + + steps = (end - src->start) / src->step; #if 0 printf ("DEBUG: start == %lu, end == %lu, %lu steps\n", - src->start, src->end, steps); + src->start, src->end_orig, steps); #endif switch (dst->vf.op) { case VDEF_PERCENT:{ -- 2.30.2