From 3c4537495f4ef8598469d4ec6a5334d54779eab1 Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 23 Mar 2024 09:19:36 -0300 Subject: [PATCH 1/2] Implement --- dll/kernel32.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 07e9989..1d67cdd 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -1133,13 +1133,18 @@ namespace kernel32 { void WIN_FUNC GetSystemTime(SYSTEMTIME *lpSystemTime) { DEBUG_LOG("GetSystemTime\n"); - lpSystemTime->wYear = 0; - lpSystemTime->wMonth = 0; - lpSystemTime->wDayOfWeek = 0; - lpSystemTime->wDay = 0; - lpSystemTime->wHour = 0; - lpSystemTime->wMinute = 0; - lpSystemTime->wSecond = 0; + + time_t t = time(NULL); + struct tm *tm = gmtime(&t); + assert(tm != NULL); + + lpSystemTime->wYear = tm->tm_year + 1900; + lpSystemTime->wMonth = tm->tm_mon + 1; + lpSystemTime->wDayOfWeek = tm->tm_wday; + lpSystemTime->wDay = tm->tm_mday; + lpSystemTime->wHour = tm->tm_hour; + lpSystemTime->wMinute = tm->tm_min; + lpSystemTime->wSecond = tm->tm_sec; lpSystemTime->wMilliseconds = 0; } From 2893ab1f174258d06e74ddb5eaa8bd9860c8ed1e Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 23 Mar 2024 09:22:39 -0300 Subject: [PATCH 2/2] GetLocalTime --- dll/kernel32.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 1d67cdd..b899b3d 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -1150,7 +1150,19 @@ namespace kernel32 { void WIN_FUNC GetLocalTime(SYSTEMTIME *lpSystemTime) { DEBUG_LOG("GetLocalTime\n"); - GetSystemTime(lpSystemTime); + + time_t t = time(NULL); + struct tm *tm = localtime(&t); + assert(tm != NULL); + + lpSystemTime->wYear = tm->tm_year + 1900; + lpSystemTime->wMonth = tm->tm_mon + 1; + lpSystemTime->wDayOfWeek = tm->tm_wday; + lpSystemTime->wDay = tm->tm_mday; + lpSystemTime->wHour = tm->tm_hour; + lpSystemTime->wMinute = tm->tm_min; + lpSystemTime->wSecond = tm->tm_sec; + lpSystemTime->wMilliseconds = 0; } int WIN_FUNC SystemTimeToFileTime(const SYSTEMTIME *lpSystemTime, FILETIME *lpFileTime) {