mirror of https://github.com/decompals/wibo.git
Proper implementation for `GetSystemTime` and `GetLocalTime` (#73)
* Implement * GetLocalTime
This commit is contained in:
parent
0fbe87751f
commit
396008c593
|
@ -1133,19 +1133,36 @@ 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;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue