1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/newlib_syscalls_default: Add _gettimeofday_r stub

This commit is contained in:
Joakim Nohlgård 2018-03-18 10:04:51 +01:00
parent 30f6f0033f
commit 01970e9644

View File

@ -500,11 +500,19 @@ int _kill(pid_t pid, int sig)
#ifdef MODULE_XTIMER
int _gettimeofday_r(struct _reent *r, struct timeval *restrict tp, void *restrict tzp)
{
(void)tzp;
(void) r;
(void) tzp;
uint64_t now = xtimer_now_usec64();
tp->tv_sec = div_u64_by_1000000(now);
tp->tv_usec = now - (tp->tv_sec * US_PER_SEC);
return 0;
}
#else
int _gettimeofday_r(struct _reent *r, struct timeval *restrict tp, void *restrict tzp)
{
(void) tp;
(void) tzp;
r->_errno = ENOSYS;
return -1;
}
#endif