Skip to content
Snippets Groups Projects
Commit 01970e96 authored by Joakim Nohlgård's avatar Joakim Nohlgård
Browse files

sys/newlib_syscalls_default: Add _gettimeofday_r stub

parent 30f6f003
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment