diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-02-22 07:03:03 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-02-22 07:03:03 +0000 |
commit | 70c3580f81dd560072209fe32c740c33d3781c67 (patch) | |
tree | a914e5d669ef9bf6d7b3ed79a07157cd676c9c61 /src/common/log.c | |
parent | d01718841e5bc3d365191e74bebbccee48c8b045 (diff) | |
download | tor-70c3580f81dd560072209fe32c740c33d3781c67.tar.gz tor-70c3580f81dd560072209fe32c740c33d3781c67.zip |
Patch to localtime/gmtime handling: use the _r variants where available. Use mutexes to fake _r where necessary. Make mutexes no-ops where no threading is enabled.
svn:r3653
Diffstat (limited to 'src/common/log.c')
-rw-r--r-- | src/common/log.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/log.c b/src/common/log.c index 13a012f678..5d8e64f021 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -60,13 +60,14 @@ _log_prefix(char *buf, size_t buf_len, int severity) { time_t t; struct timeval now; + struct tm tm; size_t n; int r; tor_gettimeofday(&now); t = (time_t)now.tv_sec; - n = strftime(buf, buf_len, "%b %d %H:%M:%S", localtime(&t)); + n = strftime(buf, buf_len, "%b %d %H:%M:%S", tor_localtime_r(&t, &tm)); r = tor_snprintf(buf+n, buf_len-n, ".%.3ld [%s] ", (long)now.tv_usec / 1000, sev_to_string(severity)); |