From 0dcaeec9592434780b0975a76f92ef6f58b5116c Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 20 Feb 2018 22:24:35 -0500 Subject: [PATCH] In __libnx_gtod() set tv_usec, and moved+updated the timezones comment. --- nx/source/runtime/newlib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nx/source/runtime/newlib.c b/nx/source/runtime/newlib.c index 561ef34e..43463d4b 100644 --- a/nx/source/runtime/newlib.c +++ b/nx/source/runtime/newlib.c @@ -28,6 +28,8 @@ static struct _reent* __libnx_get_reent(void) { return tv->reent; } +//TODO: timeGetCurrentTime() returns UTC time. How to handle timezones? + int __libnx_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz) { if (tp != NULL) { u64 now=0; @@ -40,10 +42,10 @@ int __libnx_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz) { } tp->tv_sec = now; - tp->tv_usec = 0;//timeGetCurrentTime() only returns seconds. + tp->tv_usec = now*1000000;//timeGetCurrentTime() only returns seconds. } - if (tz != NULL) {//TODO: This needs handled properly, timeGetCurrentTime() returns UTC time. + if (tz != NULL) { tz->tz_minuteswest = 0; tz->tz_dsttime = 0; }