From eefc1c471c6a3ef7b5cba390a022596edd9c4d0f Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Sun, 22 Jan 2017 15:14:25 -0200 Subject: [PATCH] ntdll: Fake success if changing system date is a no-op. Signed-off-by: Bruno Jesus <00cpxxx@gmail.com> Signed-off-by: Alexandre Julliard --- dlls/ntdll/time.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c index 96ffcfad52f..d232c4c111a 100644 --- a/dlls/ntdll/time.c +++ b/dlls/ntdll/time.c @@ -951,14 +951,21 @@ NTSTATUS WINAPI NtSetSystemTime(const LARGE_INTEGER *NewTime, LARGE_INTEGER *Old RtlTimeToSecondsSince1970( NewTime, &sec ); + /* fake success if time didn't change */ + if (oldsec == sec) + return STATUS_SUCCESS; + /* set the new time */ tv.tv_sec = sec; tv.tv_usec = 0; #ifdef HAVE_SETTIMEOFDAY - if (!settimeofday(&tv, NULL)) /* 0 is OK, -1 is error */ - return STATUS_SUCCESS; tm_t = sec; + if (!settimeofday(&tv, NULL)) /* 0 is OK, -1 is error */ + { + TRACE("OS time changed to %s\n", ctime(&tm_t)); + return STATUS_SUCCESS; + } ERR("Cannot set time to %s, time adjustment %ld: %s\n", ctime(&tm_t), (long)(sec-oldsec), strerror(errno)); if (errno == EPERM)