[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XENIFACE PATCH] Call SetLocalTime twice to set system time



Per Microsoft, SetLocalTime must be called twice to correctly update
system time while taking daylight saving time into account.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenagent/xenifacedevice.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/xenagent/xenifacedevice.cpp b/src/xenagent/xenifacedevice.cpp
index 7b45c8c..f81a838 100644
--- a/src/xenagent/xenifacedevice.cpp
+++ b/src/xenagent/xenifacedevice.cpp
@@ -537,8 +537,11 @@ void CXenIfaceDeviceList::SetXenTime(CXenIfaceDevice* 
device, bool forced)
                    sys.wYear, sys.wMonth, sys.wDay,
                    sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds);
 
-    if (local)
+    if (local) {
+        // Must call SetLocalTime twice to correctly adjust DST per Microsoft.
         SetLocalTime(&sys);
-    else
+        SetLocalTime(&sys);
+    } else {
         SetSystemTime(&sys);
+    }
 }
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.