2
0
Fork 0

fix ev_tstamp vs. time_t problems in worker_current_timestamp()

This commit is contained in:
Thomas Porzelt 2009-01-09 21:32:49 +01:00
parent 00869413ee
commit 70a495de6f
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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)