Use and propagate microsecond-precision timestamps to FormatTime

This enables sub-second precision timestamp formatting for logs and
clients without server-time.
This commit is contained in:
Vladimir Panteleev
2017-10-24 21:45:44 +00:00
parent 901a21e91b
commit 03c4c0b165
6 changed files with 21 additions and 10 deletions
+4 -2
View File
@@ -154,8 +154,10 @@ class CListSockets : public CModule {
CString GetCreatedTime(Csock* pSocket) {
unsigned long long iStartTime = pSocket->GetStartTime();
time_t iTime = iStartTime / 1000;
return CUtils::FormatTime(iTime, "%Y-%m-%d %H:%M:%S",
timeval tv;
tv.tv_sec = iStartTime / 1000;
tv.tv_usec = iStartTime % 1000 * 1000;
return CUtils::FormatTime(tv, "%Y-%m-%d %H:%M:%S.%L",
GetUser()->GetTimezone());
}