Add timezone to timestamp in JSON logs

pull/1470/head
Alexander Gozman 10 years ago committed by Victor Julien
parent 2918a75da1
commit b12c53cd51

@ -128,11 +128,11 @@ void CreateIsoTimeString (const struct timeval *ts, char *str, size_t size)
time_t time = ts->tv_sec;
struct tm local_tm;
struct tm *t = (struct tm*)SCLocalTime(time, &local_tm);
char time_fmt[64] = { 0 };
if (likely(t != NULL)) {
snprintf(str, size, "%04d-%02d-%02dT%02d:%02d:%02d.%06u",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour,
t->tm_min, t->tm_sec, (uint32_t) ts->tv_usec);
strftime(time_fmt, sizeof(time_fmt), "%Y-%m-%dT%H:%M:%S.%%06u%z", t);
snprintf(str, size, time_fmt, ts->tv_usec);
} else {
snprintf(str, size, "ts-error");
}

Loading…
Cancel
Save