Use time zone string instead of offset.

This is done by setting the TZ variable prior to calling localtime() or ctime().

There are a few calls to ctime()/localtime() which doesn’t adjust for time zone offset. This patch affects the behavior of these since the TZ variable is global.
This commit is contained in:
Allan Odgaard
2011-10-09 16:51:19 +02:00
parent b8247095d1
commit eca0211bb8
4 changed files with 7 additions and 8 deletions

View File

@@ -189,7 +189,7 @@ private:
sReason = SIMPLE_AWAY_DEFAULT_REASON;
time_t iTime = time(NULL);
iTime += (time_t)(m_pUser->GetTimezoneOffset() * 60 * 60); // offset is in hours
setenv("TZ", m_pUser->GetTimezone().c_str(), 1);
CString sTime = ctime(&iTime);
sTime.Trim();
sReason.Replace("%s", sTime);