From 41c0deca1cf367daccb4215cddbcbc2cbc344d1c Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 18 Jan 2011 14:18:09 +0000 Subject: [PATCH] update timestamp continuity checks in rrd_cached ... allow sub-second precision git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4@2173 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_daemon.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/program/src/rrd_daemon.c b/program/src/rrd_daemon.c index 83d7e1c3..215b6208 100644 --- a/program/src/rrd_daemon.c +++ b/program/src/rrd_daemon.c @@ -187,7 +187,7 @@ struct cache_item_s char **values; size_t values_num; time_t last_flush_time; - time_t last_update_stamp; + double last_update_stamp; #define CI_FLAGS_IN_TREE (1<<0) #define CI_FLAGS_IN_QUEUE (1<<1) int flags; @@ -1419,7 +1419,7 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */ while (buffer_size > 0) { char *value; - time_t stamp; + double stamp; char *eostamp; status = buffer_get_field (&buffer, &buffer_size, &value); @@ -1429,8 +1429,9 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */ break; } - /* make sure update time is always moving forward */ - stamp = strtol(value, &eostamp, 10); + /* make sure update time is always moving forward. We use double here since + update does support subsecond precision for timestamps ... */ + stamp = strtod(value, &eostamp); if (eostamp == value || eostamp == NULL || *eostamp != ':') { pthread_mutex_unlock(&cache_lock); @@ -1441,8 +1442,8 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */ { pthread_mutex_unlock(&cache_lock); return send_response(sock, RESP_ERR, - "illegal attempt to update using time %ld when last" - " update time is %ld (minimum one second step)\n", + "illegal attempt to update using time %lf when last" + " update time is %lf (minimum one second step)\n", stamp, ci->last_update_stamp); } else -- 2.30.2