Implemented SetLocalTime.
This commit is contained in:
parent
0e65a49b2b
commit
5910c68101
|
@ -671,7 +671,7 @@ import ntdll.dll
|
||||||
652 stdcall SetHandleCount(long) SetHandleCount
|
652 stdcall SetHandleCount(long) SetHandleCount
|
||||||
653 stdcall SetHandleInformation(long long long) SetHandleInformation
|
653 stdcall SetHandleInformation(long long long) SetHandleInformation
|
||||||
654 stdcall SetLastError(long) SetLastError
|
654 stdcall SetLastError(long) SetLastError
|
||||||
655 stub SetLocalTime
|
655 stdcall SetLocalTime(ptr) SetLocalTime
|
||||||
656 stdcall SetLocaleInfoA(long long str) SetLocaleInfoA
|
656 stdcall SetLocaleInfoA(long long str) SetLocaleInfoA
|
||||||
657 stub SetLocaleInfoW
|
657 stub SetLocaleInfoW
|
||||||
658 stub SetMailslotInfo
|
658 stub SetMailslotInfo
|
||||||
|
|
38
win32/time.c
38
win32/time.c
|
@ -37,6 +37,35 @@ VOID WINAPI GetLocalTime(LPSYSTEMTIME systime)
|
||||||
systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
|
systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SetLocalTime (KERNEL32.655)
|
||||||
|
*
|
||||||
|
* FIXME: correct ? Is the timezone param of settimeofday() needed ?
|
||||||
|
* I don't have any docu about SetLocal/SystemTime(), argl...
|
||||||
|
*/
|
||||||
|
VOID WINAPI SetLocalTime(LPSYSTEMTIME systime)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
struct tm t;
|
||||||
|
time_t sec;
|
||||||
|
|
||||||
|
/* get the number of seconds */
|
||||||
|
t.tm_sec = systime->wSecond;
|
||||||
|
t.tm_min = systime->wMinute;
|
||||||
|
t.tm_hour = systime->wHour;
|
||||||
|
t.tm_mday = systime->wDay;
|
||||||
|
t.tm_mon = systime->wMonth;
|
||||||
|
t.tm_year = systime->wYear;
|
||||||
|
sec = mktime (&t);
|
||||||
|
|
||||||
|
/* set the new time */
|
||||||
|
tv.tv_sec = sec;
|
||||||
|
tv.tv_usec = systime->wMilliseconds * 1000;
|
||||||
|
return !settimeofday(&tv, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetSystemTime (KERNEL32.285)
|
* GetSystemTime (KERNEL32.285)
|
||||||
*/
|
*/
|
||||||
|
@ -86,14 +115,7 @@ BOOL WINAPI SetSystemTime(const SYSTEMTIME *systime)
|
||||||
/* set the new time */
|
/* set the new time */
|
||||||
tv.tv_sec = sec;
|
tv.tv_sec = sec;
|
||||||
tv.tv_usec = systime->wMilliseconds * 1000;
|
tv.tv_usec = systime->wMilliseconds * 1000;
|
||||||
if (settimeofday(&tv, &tz))
|
return !settimeofday(&tv, &tz);
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue