Show
Ignore:
Timestamp:
05/01/04 21:18:53 (10 years ago)
Author:
khali
Message:

New --rrd-no-average parameter.

Syncronize time slots with rrd.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/sensord/sensord.c

    r1389 r2503  
    2929#include <syslog.h> 
    3030#include <unistd.h> 
     31#include <time.h> 
    3132#include <sys/types.h> 
    3233#include <sys/stat.h> 
     
    7677(void) { 
    7778  int ret = 0; 
    78   int scanValue = 0, logValue = 0, rrdValue = 0; 
     79  int scanValue = 0, logValue = 0; 
     80  /* 
     81   * First RRD update at next RRD timeslot to prevent failures due 
     82   * one timeslot updated twice on restart for example. 
     83   */ 
     84  int rrdValue = rrdTime - time(NULL) % rrdTime; 
    7985 
    8086  sensorLog (LOG_INFO, "sensord started"); 
     
    94100    if ((ret == 0) && rrdTime && rrdFile && (rrdValue <= 0)) { 
    95101      ret = rrdUpdate (); 
    96       rrdValue += rrdTime; 
     102      /* 
     103       * The amount of time to wait is computed using the same method as 
     104       * in RRD instead of simply adding the interval. 
     105       */ 
     106      rrdValue = rrdTime - time(NULL) % rrdTime; 
    97107    } 
    98108    if (!done && (ret == 0)) {