fix ev_tstamp vs. time_t problems in worker_current_timestamp()
This commit is contained in:
parent
00869413ee
commit
70a495de6f
|
@ -42,7 +42,7 @@ struct statistics_t {
|
|||
if ((srv)->worker_count > 1) g_static_rec_mutex_unlock(lock)
|
||||
|
||||
struct worker_ts {
|
||||
ev_tstamp last_generated;
|
||||
time_t last_generated;
|
||||
GString *str;
|
||||
};
|
||||
typedef struct worker_ts worker_ts;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue