From 96dce1a8b6984569bbf77e2135baa862036d1b2a Mon Sep 17 00:00:00 2001 From: yellows8 Date: Wed, 3 Oct 2018 20:55:58 -0400 Subject: [PATCH] In __libnx_gtod set errno to EIO instead of EINVAL when __boottime is invalid due to timeGetCurrentTime() failing during time init, and added this to __libnx_clock_gettime. Set errno to ENOSYS in __libnx_clock_settime. --- nx/source/runtime/newlib.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nx/source/runtime/newlib.c b/nx/source/runtime/newlib.c index 3212b39a..710b5dbd 100644 --- a/nx/source/runtime/newlib.c +++ b/nx/source/runtime/newlib.c @@ -70,6 +70,12 @@ int __libnx_clock_gettime(clockid_t clock_id, struct timespec *tp) { return -1; } if(tp) { + + if(__boottime == UINT64_MAX) { + errno = EIO; + return -1; + } + u64 now=armGetSystemTick() - __bootticks; u64 __bootsecs = now / 19200000ULL; @@ -85,7 +91,7 @@ int __libnx_clock_gettime(clockid_t clock_id, struct timespec *tp) { } int __libnx_clock_settime(clockid_t clock_id,const struct timespec *tp) { - errno = EINVAL; + errno = ENOSYS; return -1; } @@ -93,7 +99,7 @@ int __libnx_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz) { if (tp != NULL) { if(__boottime == UINT64_MAX) { - ptr->_errno = EINVAL; + ptr->_errno = EIO; return -1; }