From 43796accda21090f0d2fc7d741732827d384219e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 11 Feb 2009 16:05:33 +0000 Subject: [PATCH] 2009-02-12 Tatsuhiro Tsujikawa Assign the value of tv.tv_sec to time_t timesec instead of giving tv.tv_sec to localtime_r directly because tv.tv_sec may not be of type time_t. * src/SimpleLogger.cc --- ChangeLog | 7 +++++++ src/SimpleLogger.cc | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8f080761..6962aee5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-02-12 Tatsuhiro Tsujikawa + + Assign the value of tv.tv_sec to time_t timesec instead of giving + tv.tv_sec to localtime_r directly because tv.tv_sec may not be of + type time_t. + * src/SimpleLogger.cc + 2009-02-11 Tatsuhiro Tsujikawa Added test for FtpConnection::receiveSizeResponse(). diff --git a/src/SimpleLogger.cc b/src/SimpleLogger.cc index b44b3da8..394a708e 100644 --- a/src/SimpleLogger.cc +++ b/src/SimpleLogger.cc @@ -147,7 +147,9 @@ void SimpleLogger::writeLog(std::ostream& o, Logger::LEVEL level, gettimeofday(&tv, 0); char datestr[27]; // 'YYYY-MM-DD hh:mm:ss.uuuuuu'+'\0' = 27 bytes struct tm tm; - localtime_r(&tv.tv_sec, &tm); + //tv.tv_sec may not be of type time_t. + time_t timesec = tv.tv_sec; + localtime_r(×ec, &tm); size_t dateLength = strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", &tm); assert(dateLength <= (size_t)20);