mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-25 06:12:40 +02:00
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.
This commit is contained in:
parent
0b1b7039ca
commit
96dce1a8b6
@ -70,6 +70,12 @@ int __libnx_clock_gettime(clockid_t clock_id, struct timespec *tp) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(tp) {
|
if(tp) {
|
||||||
|
|
||||||
|
if(__boottime == UINT64_MAX) {
|
||||||
|
errno = EIO;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
u64 now=armGetSystemTick() - __bootticks;
|
u64 now=armGetSystemTick() - __bootticks;
|
||||||
|
|
||||||
u64 __bootsecs = now / 19200000ULL;
|
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) {
|
int __libnx_clock_settime(clockid_t clock_id,const struct timespec *tp) {
|
||||||
errno = EINVAL;
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +99,7 @@ int __libnx_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz) {
|
|||||||
if (tp != NULL) {
|
if (tp != NULL) {
|
||||||
|
|
||||||
if(__boottime == UINT64_MAX) {
|
if(__boottime == UINT64_MAX) {
|
||||||
ptr->_errno = EINVAL;
|
ptr->_errno = EIO;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user