Commit 5910c681 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Implemented SetLocalTime.

parent 0e65a49b
......@@ -671,7 +671,7 @@ import ntdll.dll
652 stdcall SetHandleCount(long) SetHandleCount
653 stdcall SetHandleInformation(long long long) SetHandleInformation
654 stdcall SetLastError(long) SetLastError
655 stub SetLocalTime
655 stdcall SetLocalTime(ptr) SetLocalTime
656 stdcall SetLocaleInfoA(long long str) SetLocaleInfoA
657 stub SetLocaleInfoW
658 stub SetMailslotInfo
......
......@@ -37,6 +37,35 @@ VOID WINAPI GetLocalTime(LPSYSTEMTIME systime)
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)
*/
......@@ -86,14 +115,7 @@ BOOL WINAPI SetSystemTime(const SYSTEMTIME *systime)
/* set the new time */
tv.tv_sec = sec;
tv.tv_usec = systime->wMilliseconds * 1000;
if (settimeofday(&tv, &tz))
{
return FALSE;
}
else
{
return TRUE;
}
return !settimeofday(&tv, &tz);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment