diff options
Diffstat (limited to 'Source/cmTimestamp.cxx')
-rw-r--r-- | Source/cmTimestamp.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index c624d0f..61b74db 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -22,7 +22,7 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString, bool utcFlag) { - time_t currentTimeT = time(0); + time_t currentTimeT = time(CM_NULLPTR); if (currentTimeT == time_t(-1)) { return std::string(); } @@ -56,14 +56,14 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT, struct tm timeStruct; memset(&timeStruct, 0, sizeof(timeStruct)); - struct tm* ptr = (struct tm*)0; + struct tm* ptr = (struct tm*)CM_NULLPTR; if (utcFlag) { ptr = gmtime(&timeT); } else { ptr = localtime(&timeT); } - if (ptr == 0) { + if (ptr == CM_NULLPTR) { return std::string(); } @@ -93,10 +93,9 @@ time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm& tm) const #else // From Linux timegm() manpage. - std::string tz_old = "TZ="; - if (const char* tz = cmSystemTools::GetEnv("TZ")) { - tz_old += tz; - } + std::string tz_old = ""; + cmSystemTools::GetEnv("TZ", tz_old); + tz_old = "TZ=" + tz_old; // The standard says that "TZ=" or "TZ=[UNRECOGNIZED_TZ]" means UTC. // It seems that "TZ=" does NOT work, at least under Windows @@ -152,7 +151,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag, return std::string(); } - std::stringstream ss; + std::ostringstream ss; ss << static_cast<long int>(difftime(timeT, unixEpoch)); return ss.str(); } |