diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-05-18 15:40:29 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-07-10 23:41:14 +0200 |
commit | 611c2f4a09c0e803c8c9fa1bf26b59e9ab607d71 (patch) | |
tree | 8c52d20924d411af755e439c9d91376387c5a25e /src | |
parent | 0606971cb408c9635f17db8862dd5aa92551735c (diff) |
Fix: not retrieve timestamp from arguments
Change-Id: I7aaaa4c544428899d7e383b3bbd2ae29312ca15b
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/influxdb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/influxdb.c b/src/plugins/influxdb.c index 4c69e98..c2fe118 100644 --- a/src/plugins/influxdb.c +++ b/src/plugins/influxdb.c @@ -159,7 +159,8 @@ void unpacking_from_api(void *s, json_object *valueJ, const char *key) if(strcasecmp("name", key) == 0) serie->name = json_object_get_string(valueJ); else if(strcasecmp("timestamp", key) == 0) - serie->timestamp = get_ts(); + serie->timestamp = (json_object_is_type(valueJ, json_type_int)) ? + json_object_get_int64(valueJ) : 0; else if(strcasecmp("metadata", key) == 0) wrap_json_object_for_all(valueJ, unpack_metadata, (void*)&serie->serie_columns.tags); else if(strcasecmp("value", key) == 0 || strcasecmp("values", key) == 0) @@ -178,8 +179,9 @@ int unpack_metric_from_api(json_object *m, struct series_t *serie) { wrap_json_object_for_all(m, unpacking_from_api, serie); - if(!serie->timestamp) + if(! serie->timestamp) { serie->timestamp = get_ts(); + } return 0; } |