mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[winpr,sysinfo] use a single clock to provide System and Local time
... rather than a different one for second and sub-second part
This commit is contained in:
@@ -248,8 +248,9 @@ void GetSystemTime(LPSYSTEMTIME lpSystemTime)
|
||||
struct tm tres;
|
||||
struct tm* stm = NULL;
|
||||
WORD wMilliseconds = 0;
|
||||
ct = time(NULL);
|
||||
wMilliseconds = (WORD)(GetTickCount() % 1000);
|
||||
UINT64 now = winpr_GetUnixTimeNS();
|
||||
ct = WINPR_TIME_NS_TO_S(now);
|
||||
wMilliseconds = (WORD)(WINPR_TIME_NS_REM_MS(now));
|
||||
stm = gmtime_r(&ct, &tres);
|
||||
ZeroMemory(lpSystemTime, sizeof(SYSTEMTIME));
|
||||
|
||||
@@ -279,8 +280,9 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
|
||||
struct tm tres;
|
||||
struct tm* ltm = NULL;
|
||||
WORD wMilliseconds = 0;
|
||||
ct = time(NULL);
|
||||
wMilliseconds = (WORD)(GetTickCount() % 1000);
|
||||
UINT64 now = winpr_GetUnixTimeNS();
|
||||
ct = WINPR_TIME_NS_TO_S(now);
|
||||
wMilliseconds = (WORD)(WINPR_TIME_NS_REM_MS(now));
|
||||
ltm = localtime_r(&ct, &tres);
|
||||
ZeroMemory(lpSystemTime, sizeof(SYSTEMTIME));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user