Windows 10/Server 2016 changed how Windows maintains the accuracy of its
clock
This can allow reported time to drift away from host time, and Windows time
will need to be updated regularly in order to minimise the drift.
* Add a wrapper for SetXenTime to manage the critical section
* Remove SetXenTime from CheckSuspend and call it from the calling function
* Add a timeout to the WaitForMultipleObjectsEx, which calls SetXenTime
* Prevent SetXenTime from updating the time if its not changed (and avoid
outputting the log lines)
Signed-off-by: Owen Smith <owen.smith@citrix.com>
Moved the call to get current time earlier in SetXenTime() and also made
it call GetSystemTime() if the RTC is in UTC. Also added missing
__fallthrough annotation for case WAIT_TIMEOUT in ServiceMainLoop().
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>