X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=errlog.c;h=7cc4e200dcd938216e37b9cf7b247568e632afd2;hb=283e98e3f6ca776c1a15cd076e6ae1e999d8a6b3;hp=05a2c82e2bf189790c0e13f026f60af7d2222fca;hpb=c913ac4a0852f81fe6b4f43a2f2dfd703c94352f;p=privoxy.git diff --git a/errlog.c b/errlog.c index 05a2c82e..7cc4e200 100644 --- a/errlog.c +++ b/errlog.c @@ -533,21 +533,12 @@ static inline size_t get_clf_timestamp(char *buffer, size_t buffer_size) int tz_length = 0; time (&now); -#ifdef HAVE_GMTIME_R - gmt = *gmtime_r(&now, &gmt); -#elif defined(MUTEX_LOCKS_AVAILABLE) - privoxy_mutex_lock(&gmtime_mutex); - gmt = *gmtime(&now); - privoxy_mutex_unlock(&gmtime_mutex); -#else - gmt = *gmtime(&now); -#endif + gmt = *privoxy_gmtime_r(&now, &gmt); #ifdef HAVE_LOCALTIME_R tm_now = localtime_r(&now, &dummy); #elif defined(MUTEX_LOCKS_AVAILABLE) privoxy_mutex_lock(&localtime_mutex); tm_now = localtime(&now); - privoxy_mutex_unlock(&localtime_mutex); #else tm_now = localtime(&now); #endif @@ -556,6 +547,9 @@ static inline size_t get_clf_timestamp(char *buffer, size_t buffer_size) mins = hrs * 60 + tm_now->tm_min - gmt.tm_min; length = strftime(buffer, buffer_size, "%d/%b/%Y:%H:%M:%S ", tm_now); +#if !defined(HAVE_LOCALTIME_R) && defined(MUTEX_LOCKS_AVAILABLE) + privoxy_mutex_unlock(&localtime_mutex); +#endif if (length > (size_t)0) {