fix for json dates (jan is 0, dec is 11)
Costa Tsaousis (ktsaou) committed
Mar 24, 2014 at 22:29 UTC
f8ac4c03f0564a568c323f71953ec86b458f6cda
1 file changed
+2
-1
netdata.c
+2
-1
@@ -549,7 +549,8 @@ size_t rrd_stats_json(RRD_STATS *st, char *b, size_t length, size_t entries_to_s
549
struct tm *tm = localtime(&st->times[t].tv_sec);
550
if(!tm) { error("localtime() failed."); continue; }
551
552
- strftime(dtm, 200, "\"Date(%Y, %m, %d, %H, %M, %S)\"", tm); // datetime
552
+ sprintf(dtm, "\"Date(%d, %d, %d, %d, %d, %d)\"", tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); // datetime
553
+ // strftime(dtm, 200, "\"Date(%Y, %m, %d, %H, %M, %S)\"", tm); // datetime
554
// strftime(dtm, 200, "[%H, %M, %S, 0]", tm); // timeofday
555
i += sprintf(&b[i], "%s {\"c\":[{\"v\":%s},", printed?"]},\n":"", dtm);
556