From: Sebastian Harl Date: Thu, 21 Aug 2014 03:12:58 +0000 (-0700) Subject: store: Fixed JSON-serialization of time-series data. X-Git-Tag: sysdb-0.4.0~23 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=255a2d91ea0ad1992283760a02c9ea0c1177429b store: Fixed JSON-serialization of time-series data. Typos caused the end-time and all values to be treated incorrectly. --- diff --git a/src/core/store.c b/src/core/store.c index c778c52..3bc1114 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -551,7 +551,7 @@ ts_tojson(sdb_timeseries_t *ts, sdb_strbuf_t *buf) snprintf(start_str, sizeof(start_str), ""); start_str[sizeof(start_str) - 1] = '\0'; if (! sdb_strftime(end_str, sizeof(end_str), - "%F %T %z", ts->start)) + "%F %T %z", ts->end)) snprintf(end_str, sizeof(end_str), ""); end_str[sizeof(end_str) - 1] = '\0'; @@ -571,7 +571,7 @@ ts_tojson(sdb_timeseries_t *ts, sdb_strbuf_t *buf) time_str[sizeof(time_str) - 1] = '\0'; sdb_strbuf_append(buf, "{\"timestamp\": \"%s\", " - "\"value\": \"%s\"}", time_str, ts->data[i][j].value); + "\"value\": \"%f\"}", time_str, ts->data[i][j].value); if (j < ts->data_len - 1) sdb_strbuf_append(buf, ",");