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

Merge pull request #4286 from kaspar030/make_newlib_use_xtimer

sys: newlib: use xtimer_now64() for gettimeofday()
This commit is contained in:
Oleg Hahm 2015-11-17 21:08:01 +01:00
commit bfb6c0c95d

View File

@ -38,6 +38,12 @@
#include "uart_stdio.h"
#ifdef MODULE_XTIMER
#include <sys/time.h>
#include "div.h"
#include "xtimer.h"
#endif
/**
* @brief manage the heap
*/
@ -322,3 +328,14 @@ int _kill(pid_t pid, int sig)
errno = ESRCH; /* not implemented yet */
return -1;
}
#ifdef MODULE_XTIMER
int _gettimeofday_r(struct _reent *r, struct timeval *restrict tp, void *restrict tzp)
{
(void)tzp;
uint64_t now = xtimer_now64();
tp->tv_sec = div_u64_by_1000000(now);
tp->tv_usec = now - (tp->tv_sec * SEC_IN_USEC);
return 0;
}
#endif