summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f0c6bba)
raw | patch | inline | side by side (parent: f0c6bba)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 16 Jan 2003 23:27:54 +0000 (23:27 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 16 Jan 2003 23:27:54 +0000 (23:27 +0000) |
-- Stanislav Sinyagin <ssinyagin@yahoo.com>
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@172 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@172 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_fetch.c | patch | blob | history |
diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c
index 3260904ea30502e59856d627e5a214db4f7ec7a7..d5c5709450a1febd6e3c7522a0d4f2e0e3de5260 100644 (file)
--- a/src/rrd_fetch.c
+++ b/src/rrd_fetch.c
*****************************************************************************
* $Id$
* $Log$
+ * Revision 1.6 2003/01/16 23:27:54 oetiker
+ * fix border condition in rra selection of rrd_fetch
+ * -- Stanislav Sinyagin <ssinyagin@yahoo.com>
+ *
* Revision 1.5 2002/06/23 22:29:40 alex
* Added "step=1800" and such to "DEF"
* Cleaned some of the signed vs. unsigned problems
cal_start,cal_end,
rrd.stat_head->pdp_step * rrd.rra_def[i].pdp_cnt);
#endif
+ /* we need step difference in either full or partial case */
+ tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step
+ * rrd.rra_def[i].pdp_cnt));
/* best full match */
if(cal_end >= *end
&& cal_start <= *start){
- tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step
- * rrd.rra_def[i].pdp_cnt));
if (first_full || (tmp_step_diff < best_step_diff)){
first_full=0;
best_step_diff = tmp_step_diff;
tmp_match -= (cal_start-*start);
if (cal_end<*end)
tmp_match -= (*end-cal_end);
- if (first_part || best_match < tmp_match){
+ if (first_part ||
+ (best_match < tmp_match) ||
+ (best_match == tmp_match &&
+ tmp_step_diff < best_step_diff)){
#ifdef DEBUG
fprintf(stderr,"best partial so far\n");
#endif
first_part=0;
best_match = tmp_match;
+ best_step_diff = tmp_step_diff;
best_part_rra =i;
} else {
#ifdef DEBUG