Cache timezone and daylight active flag for safer logging.

With such information will be able to use a private localtime()
implementation serverLog(), which does not use any locking and is both
thread and fork() safe.
This commit is contained in:
antirez
2018-07-04 16:44:57 +02:00
parent 18d8205bbd
commit 81778d91bf
2 changed files with 14 additions and 1 deletions

View File

@ -1192,6 +1192,8 @@ struct redisServer {
int list_compress_depth;
/* time cache */
time_t unixtime; /* Unix time sampled every cron cycle. */
time_t timezone; /* Cached timezone. As set by tzset(). */
int daylight_active; /* Currently in daylight saving time. */
long long mstime; /* Like 'unixtime' but with milliseconds resolution. */
/* Pubsub */
dict *pubsub_channels; /* Map channels to list of subscribed clients */