bmsd/fermenters.c

branch
stable
changeset 665
4d01937ae7af
parent 558
a8e065a9f851
child 671
4b54d6f79d25
equal deleted inserted replaced
521:9d1aa6f3a4da 665:4d01937ae7af
442 log->fermenter_alias = xstrcpy(alias); 442 log->fermenter_alias = xstrcpy(alias);
443 jobj = json_tokener_parse(payload); 443 jobj = json_tokener_parse(payload);
444 444
445 if (json_object_object_get_ex(jobj, "timestamp", &val)) { 445 if (json_object_object_get_ex(jobj, "timestamp", &val)) {
446 timestamp = json_object_get_int(val); 446 timestamp = json_object_get_int(val);
447 log->datetime = malloc(21); 447 log->datetime = malloc(73);
448 mytime = localtime(&timestamp); 448 mytime = localtime(&timestamp);
449 snprintf(log->datetime, 20, "%04d-%02d-%02d %02d:%02d:%02d", 449 snprintf(log->datetime, 73, "%04d-%02d-%02d %02d:%02d:%02d",
450 mytime->tm_year + 1900, mytime->tm_mon + 1, mytime->tm_mday, mytime->tm_hour, mytime->tm_min, mytime->tm_sec); 450 mytime->tm_year + 1900, mytime->tm_mon + 1, mytime->tm_mday, mytime->tm_hour, mytime->tm_min, mytime->tm_sec);
451 } 451 }
452 452
453 if (json_object_object_get_ex(jobj, "metric", &metric)) { 453 if (json_object_object_get_ex(jobj, "metric", &metric)) {
454 454

mercurial