mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:05:40 +00:00
[TIMEDATE] Correctly set the time when using the "Update now" button. CORE-14167
This commit is contained in:
parent
682735fb56
commit
912434849f
4 changed files with 22 additions and 10 deletions
|
@ -14,7 +14,8 @@
|
||||||
static WNDPROC pOldWndProc = NULL;
|
static WNDPROC pOldWndProc = NULL;
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
SystemSetLocalTime(LPSYSTEMTIME lpSystemTime)
|
SystemSetTime(LPSYSTEMTIME lpSystemTime,
|
||||||
|
BOOL SystemTime)
|
||||||
{
|
{
|
||||||
HANDLE hToken;
|
HANDLE hToken;
|
||||||
DWORD PrevSize;
|
DWORD PrevSize;
|
||||||
|
@ -45,11 +46,20 @@ SystemSetLocalTime(LPSYSTEMTIME lpSystemTime)
|
||||||
GetLastError() == ERROR_SUCCESS)
|
GetLastError() == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We successfully enabled it, we're permitted to change the system time
|
* We successfully enabled it, we're permitted to change the time.
|
||||||
* Call SetLocalTime twice to ensure correct results
|
* Check the second parameter for SystemTime and if TRUE set System Time.
|
||||||
|
* Otherwise, if FALSE set the Local Time.
|
||||||
|
* Call SetLocalTime twice to ensure correct results.
|
||||||
*/
|
*/
|
||||||
Ret = SetLocalTime(lpSystemTime) &&
|
if (SystemTime)
|
||||||
SetLocalTime(lpSystemTime);
|
{
|
||||||
|
Ret = SetSystemTime(lpSystemTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Ret = SetLocalTime(lpSystemTime) &&
|
||||||
|
SetLocalTime(lpSystemTime);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the sake of security, restore the previous status again
|
* For the sake of security, restore the previous status again
|
||||||
|
@ -86,7 +96,8 @@ SetLocalSystemTime(HWND hwnd)
|
||||||
(WPARAM)&Time,
|
(WPARAM)&Time,
|
||||||
0))
|
0))
|
||||||
{
|
{
|
||||||
SystemSetLocalTime(&Time);
|
/* Set Local Time with SystemTime = FALSE */
|
||||||
|
SystemSetTime(&Time, FALSE);
|
||||||
|
|
||||||
SetWindowLongPtrW(hwnd,
|
SetWindowLongPtrW(hwnd,
|
||||||
DWL_MSGRESULT,
|
DWL_MSGRESULT,
|
||||||
|
|
|
@ -258,7 +258,8 @@ UpdateSystemTime(ULONG ulTime)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SystemSetLocalTime(&stNew))
|
/* Use SystemSetTime with SystemTime = TRUE to set System Time */
|
||||||
|
if (!SystemSetTime(&stNew, TRUE))
|
||||||
DisplayWin32Error(GetLastError());
|
DisplayWin32Error(GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,15 +121,15 @@ ReceiveData(PINFO pInfo)
|
||||||
|
|
||||||
if ((Ret != SOCKET_ERROR) && (Ret != 0))
|
if ((Ret != SOCKET_ERROR) && (Ret != 0))
|
||||||
{
|
{
|
||||||
|
|
||||||
Ret = recvfrom(pInfo->Sock,
|
Ret = recvfrom(pInfo->Sock,
|
||||||
(char *)&pInfo->RecvPacket,
|
(char *)&pInfo->RecvPacket,
|
||||||
sizeof(pInfo->RecvPacket),
|
sizeof(pInfo->RecvPacket),
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (Ret != SOCKET_ERROR)
|
if (Ret != SOCKET_ERROR)
|
||||||
ulTime = ntohl(ulTime);
|
ulTime = ntohl(pInfo->RecvPacket.TransmitTimestamp.dwInteger);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ulTime;
|
return ulTime;
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern HINSTANCE hApplet;
|
||||||
|
|
||||||
/* dateandtime.c */
|
/* dateandtime.c */
|
||||||
INT_PTR CALLBACK DateTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK DateTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL SystemSetLocalTime(LPSYSTEMTIME lpSystemTime);
|
BOOL SystemSetTime(LPSYSTEMTIME lpSystemTime, BOOL SystemTime);
|
||||||
|
|
||||||
|
|
||||||
/* timezone.c */
|
/* timezone.c */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue