From 0b1b7039ca35548c6d0a7ab2a5d7bc1b4584337e Mon Sep 17 00:00:00 2001 From: yellows8 Date: Wed, 3 Oct 2018 19:47:56 -0400 Subject: [PATCH] Changed the value of TimeType_Default to TimeType_UserSystemClock. When timeGetCurrentTime fails where __nx_time_type isn't TimeType_Default, call it again with TimeType_Default. --- nx/include/switch/services/time.h | 2 +- nx/source/runtime/newlib.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/services/time.h b/nx/include/switch/services/time.h index 0ef21a09..8f16f1ba 100644 --- a/nx/include/switch/services/time.h +++ b/nx/include/switch/services/time.h @@ -14,7 +14,7 @@ typedef enum { TimeType_UserSystemClock, TimeType_NetworkSystemClock, TimeType_LocalSystemClock, - TimeType_Default = TimeType_NetworkSystemClock, + TimeType_Default = TimeType_UserSystemClock, } TimeType; Result timeInitialize(void); diff --git a/nx/source/runtime/newlib.c b/nx/source/runtime/newlib.c index 19c1f0ce..3212b39a 100644 --- a/nx/source/runtime/newlib.c +++ b/nx/source/runtime/newlib.c @@ -21,7 +21,7 @@ extern const u8 __tdata_lma[]; extern const u8 __tdata_lma_end[]; extern u8 __tls_start[]; -/// TimeType passed to timeGetCurrentTime() by __libnx_gtod(). +/// TimeType passed to timeGetCurrentTime() during time initialization. If that fails and __nx_time_type isn't TimeType_Default, timeGetCurrentTime() will be called again with TimeType_Default. __attribute__((weak)) TimeType __nx_time_type = TimeType_Default; static struct _reent* __libnx_get_reent(void) { @@ -38,6 +38,7 @@ static u64 __bootticks; // setup boot time variables void __libnx_init_time(void) { Result rc = timeGetCurrentTime(__nx_time_type, &__boottime); + if (R_FAILED(rc) && __nx_time_type != TimeType_Default) rc = timeGetCurrentTime(TimeType_Default, &__boottime); if (R_FAILED(rc)) { __boottime = UINT64_MAX; } else {