|
|
|
@ -157,14 +157,14 @@ GString *worker_current_timestamp(worker *wrk, guint format_ndx) {
|
|
|
|
|
gsize len;
|
|
|
|
|
struct tm tm;
|
|
|
|
|
worker_ts *wts = &g_array_index(wrk->timestamps, worker_ts, format_ndx);
|
|
|
|
|
ev_tstamp now = CUR_TS(wrk);
|
|
|
|
|
time_t now = (time_t)CUR_TS(wrk);
|
|
|
|
|
|
|
|
|
|
/* cache hit */
|
|
|
|
|
if ((now - wts->last_generated) < 1.0)
|
|
|
|
|
if (now == wts->last_generated)
|
|
|
|
|
return wts->str;
|
|
|
|
|
|
|
|
|
|
g_string_set_size(wts->str, 255);
|
|
|
|
|
if (!gmtime_r((time_t*)&now, &tm))
|
|
|
|
|
if (!gmtime_r(&now, &tm))
|
|
|
|
|
return NULL;
|
|
|
|
|
len = strftime(wts->str->str, wts->str->allocated_len, g_array_index(wrk->srv->ts_formats, GString*, format_ndx)->str, &tm);
|
|
|
|
|
if (len == 0)
|
|
|
|
|