mirror of
https://github.com/znc/znc.git
synced 2026-05-18 15:25:53 +02:00
Move TZ-related code to own place.
This commit is contained in:
@@ -155,7 +155,7 @@ public:
|
||||
CString GetCreatedTime(Csock* pSocket) {
|
||||
unsigned long long iStartTime = pSocket->GetStartTime();
|
||||
time_t iTime = iStartTime / 1000;
|
||||
return FormatTime("%Y-%m-%d %H:%M:%S", iTime);
|
||||
return CUtils::FormatTime(iTime, "%Y-%m-%d %H:%M:%S", m_pUser->GetTimezone());
|
||||
}
|
||||
|
||||
CString GetLocalHost(Csock* pSocket, bool bShowHosts) {
|
||||
@@ -241,19 +241,6 @@ public:
|
||||
virtual ~CListSockets() {
|
||||
}
|
||||
|
||||
CString FormatTime(const CString& sFormat, time_t tm = 0) const {
|
||||
char szTimestamp[1024];
|
||||
|
||||
if (tm == 0) {
|
||||
tm = time(NULL);
|
||||
}
|
||||
|
||||
setenv("TZ", m_pUser->GetTimezone().c_str(), 1);
|
||||
strftime(szTimestamp, sizeof(szTimestamp) / sizeof(char),
|
||||
sFormat.c_str(), localtime(&tm));
|
||||
|
||||
return szTimestamp;
|
||||
}
|
||||
};
|
||||
|
||||
MODULEDEFS(CListSockets, "List active sockets")
|
||||
|
||||
Reference in New Issue
Block a user