Commit 078eff2a authored by Hardy Simpson's avatar Hardy Simpson

bugfix: check for time cache, see

https://github.com/HardySimpson/zlog/issues/13
parent 2ffd3a9a
#define ZLOG_GIT_SHA1 "15631df3"
#define ZLOG_GIT_SHA1 "b5597e79"
#define ZLOG_GIT_DIRTY "0"
......@@ -67,9 +67,10 @@ static int zlog_spec_write_time(zlog_spec_t * a_spec, zlog_thread_t * a_thread,
}
/*
* It is modified when time slips one second.
* When time slips one second, or cache is not warmed up
*/
if (a_thread->event->time_stamp.tv_sec != a_thread->event->time_last) {
if (a_thread->event->time_stamp.tv_sec != a_thread->event->time_last
|| a_cache->len == 0) {
localtime_r(&(a_thread->event->time_stamp.tv_sec), &(a_thread->event->time_local));
a_cache->len = strftime(a_cache->str, sizeof(a_cache->str),
a_spec->time_fmt, &(a_thread->event->time_local));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment