Code

prepare for the release of rrdtool-1.2.29
[rrdtool-all.git] / program / src / rrd_update.c
index 9225fb08b0d3dda925d14e9ffbe79e05c0f80d95..de24b8fe75255f361f418faa3a68faba2562e6c5 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ * RRDtool 1.2.29  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_update.c  RRD Update Function
  *****************************************************************************
  */
 #include <sys/timeb.h>
 
-#ifndef __MINGW32__
+#if (defined(__MINGW32__) && \
+       ((__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 12) || __MINGW32_MAJOR_VERSION > 3))
+#include <sys/time.h>
+#else
+
 struct timeval {
        time_t tv_sec; /* seconds */
        long tv_usec;  /* microseconds */
 };
-#endif
 
 struct __timezone {
        int  tz_minuteswest; /* minutes W of Greenwich */
@@ -53,7 +56,9 @@ static int gettimeofday(struct timeval *t, struct __timezone *tz) {
        return 0;
 }
 
+#endif /* mingw32 3.4.5 */
 #endif
+
 /*
  * normilize time as returned by gettimeofday. usec part must
  * be always >= 0
@@ -528,9 +533,9 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
        if(current_time < rrd.live_head->last_up || 
          (current_time == rrd.live_head->last_up && 
           (long)current_time_usec <= (long)rrd.live_head->last_up_usec)) {
-           rrd_set_error("illegal attempt to update using time %ld when "
+           rrd_set_error("%s: illegal attempt to update using time %ld when "
                          "last update time is %ld (minimum one second step)",
-                         current_time, rrd.live_head->last_up);
+                         filename, current_time, rrd.live_head->last_up);
            free(step_start);
            break;
        }
@@ -774,7 +779,7 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
                     > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) || */
                    /* if the interval is larger thatn mrhb we get NAN */
                    (interval > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) ||
-                   (occu_pdp_st-proc_pdp_st <= 
+                    (rrd.stat_head -> pdp_step / 2.0 <
                     rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt)) {
                    pdp_temp[i] = DNAN;
                } else {