From eeb2daa2bf914df568b6a722608b8bc4e4a1e0cd Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Wed, 2 Oct 2019 17:03:39 -0700 Subject: [PATCH] [Pal/Linux] _DkSystemTimeQuery() returns REALTIME instead of MONOTONIC now _DkSystemTimeQuery() should return real time (CLOCK_REALTIME). The previously used CLOCK_MONOTONIC returns time elapsed from an unspecified starting point and is thus incorrect to use for system time. --- Pal/src/host/Linux/db_misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pal/src/host/Linux/db_misc.c b/Pal/src/host/Linux/db_misc.c index 547fbd89..42855c68 100644 --- a/Pal/src/host/Linux/db_misc.c +++ b/Pal/src/host/Linux/db_misc.c @@ -40,7 +40,7 @@ unsigned long _DkSystemTimeQueryEarly (void) struct timespec time; int ret; - ret = INLINE_SYSCALL(clock_gettime, 2, CLOCK_MONOTONIC, &time); + ret = INLINE_SYSCALL(clock_gettime, 2, CLOCK_REALTIME, &time); /* Come on, gettimeofday mostly never fails */ if (IS_ERR(ret)) @@ -71,10 +71,10 @@ unsigned long _DkSystemTimeQuery (void) #if USE_VDSO_GETTIME == 1 if (linux_state.vdso_clock_gettime) { - ret = linux_state.vdso_clock_gettime(CLOCK_MONOTONIC, &time); + ret = linux_state.vdso_clock_gettime(CLOCK_REALTIME, &time); } else { #endif - ret = INLINE_SYSCALL(clock_gettime, 2, CLOCK_MONOTONIC, &time); + ret = INLINE_SYSCALL(clock_gettime, 2, CLOCK_REALTIME, &time); #if USE_VDSO_GETTIME == 1 } #endif