Initialize RRD database files one second in the past
This commit is contained in:
parent
e8cce6837b
commit
db5a4a2863
|
@ -52,7 +52,7 @@
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static int _rrd_exec(char * argv[]);
|
static int _rrd_exec(char * argv[]);
|
||||||
static int _rrd_perror(char const * message, int ret);
|
static int _rrd_perror(char const * message, int ret);
|
||||||
static char * _rrd_timestamp(void);
|
static char * _rrd_timestamp(off_t offset);
|
||||||
|
|
||||||
|
|
||||||
/* public */
|
/* public */
|
||||||
|
@ -96,7 +96,7 @@ int rrd_create(RRDType type, char const * filename)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
argv[2] = string_new(filename);
|
argv[2] = string_new(filename);
|
||||||
argv[4] = _rrd_timestamp();
|
argv[4] = _rrd_timestamp(-1);
|
||||||
/* create the database */
|
/* create the database */
|
||||||
if(argv[2] != NULL && argv[4] != NULL)
|
if(argv[2] != NULL && argv[4] != NULL)
|
||||||
ret = _rrd_exec(argv);
|
ret = _rrd_exec(argv);
|
||||||
|
@ -233,7 +233,7 @@ static int _rrd_perror(char const * message, int ret)
|
||||||
|
|
||||||
|
|
||||||
/* rrd_timestamp */
|
/* rrd_timestamp */
|
||||||
static char * _rrd_timestamp(void)
|
static char * _rrd_timestamp(off_t offset)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
|
@ -242,5 +242,5 @@ static char * _rrd_timestamp(void)
|
||||||
_rrd_perror("gettimeofday", -errno);
|
_rrd_perror("gettimeofday", -errno);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return string_new_format("%ld", tv.tv_sec);
|
return string_new_format("%ld", tv.tv_sec + offset);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user