Bruno Jesus : ntdll: Fake success if changing system date is a no-op.

Alexandre Julliard julliard at winehq.org
Wed Jan 25 13:18:52 CST 2017


Module: wine
Branch: master
Commit: eefc1c471c6a3ef7b5cba390a022596edd9c4d0f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eefc1c471c6a3ef7b5cba390a022596edd9c4d0f

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Sun Jan 22 15:14:25 2017 -0200

ntdll: Fake success if changing system date is a no-op.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/time.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c
index 96ffcfa..d232c4c 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
+    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;
-    tm_t = sec;
+    }
     ERR("Cannot set time to %s, time adjustment %ld: %s\n",
         ctime(&tm_t), (long)(sec-oldsec), strerror(errno));
     if (errno == EPERM)




More information about the wine-cvs mailing list