From 2fe1adf0e0edde56a4dfc30392cf2f228d1703a8 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Sun, 27 May 2018 16:13:51 +0100 Subject: [PATCH] use right offset to calc micro/nano secs --- nx/source/runtime/newlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx/source/runtime/newlib.c b/nx/source/runtime/newlib.c index b559f5df..84de6f4e 100644 --- a/nx/source/runtime/newlib.c +++ b/nx/source/runtime/newlib.c @@ -73,7 +73,7 @@ int __libnx_clock_gettime(clockid_t clock_id, struct timespec *tp) { u64 __bootsecs = now / 19200000ULL; tp->tv_sec = __bootsecs + __boottime; - u64 nsecs = (now - tp->tv_sec * 19200000ULL) * 10000ULL / 192ULL; + u64 nsecs = (now - __bootsecs * 19200000ULL) * 10000ULL / 192ULL; tp->tv_nsec = nsecs - nsecs % nsec_clockres; return 0; } else { @@ -100,7 +100,7 @@ int __libnx_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz) { u64 __bootsecs = now / 19200000ULL; tp->tv_sec = __bootsecs + __boottime; - tp->tv_usec = (now - tp->tv_sec * 19200000ULL) * 10ULL / 192ULL; + tp->tv_usec = (now - __bootsecs * 19200000ULL) * 10ULL / 192ULL; } if (tz != NULL) {