From: Paul Durrant Date: Mon, 16 Sep 2019 13:23:08 +0000 (+0100) Subject: Get rid of bogus time adjustment X-Git-Tag: 9.0.0-rc1~5 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0f6cc159a37bc98b29cdee2afc593ad6679efac7;p=pvdrivers%2Fwin%2Fxeniface.git Get rid of bogus time adjustment Xen maintains synchronization between the wallclock (as reported in the shared info) and the emulated RTC. Thus all the guest agent needs to know, to correctly interpret the wallclock, is whether Windows is setting the RTC in local time or UTC. No adjustment of the wallclock is required. Signed-off-by: Paul Durrant --- diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index a77ff23..8f8f445 100644 --- a/src/xenagent/service.cpp +++ b/src/xenagent/service.cpp @@ -404,28 +404,6 @@ bool CXenIfaceCreator::IsRTCInUTC() return val; } -void CXenIfaceCreator::AdjustXenTimeToUTC(FILETIME* now) -{ - std::string vm; - if (!m_device->StoreRead("vm", vm)) - return; - - std::string offs; - if (!m_device->StoreRead(vm + "/rtc/timeoffset", offs)) - return; - - long offset = (long)atoi(offs.c_str()); - - ULARGE_INTEGER lnow; - lnow.LowPart = now->dwLowDateTime; - lnow.HighPart = now->dwHighDateTime; - - lnow.QuadPart -= ((LONGLONG)offset * 1000000); - - now->dwLowDateTime = lnow.LowPart; - now->dwHighDateTime = lnow.HighPart; -} - void CXenIfaceCreator::SetXenTime() { bool IsUTC = IsRTCInUTC(); @@ -440,9 +418,6 @@ void CXenIfaceCreator::SetXenTime() if (!m_device->SharedInfoGetTime(&now)) return; - if (IsUTC) - AdjustXenTimeToUTC(&now); - SYSTEMTIME sys = { 0 }; if (!FileTimeToSystemTime(&now, &sys)) return; diff --git a/src/xenagent/service.h b/src/xenagent/service.h index 9547177..e886de6 100644 --- a/src/xenagent/service.h +++ b/src/xenagent/service.h @@ -86,7 +86,6 @@ private: void StopSlateModeWatch(); void AcquireShutdownPrivilege(); bool IsRTCInUTC(); - void AdjustXenTimeToUTC(FILETIME* time); void SetXenTime(); private: