lib: posix: clock: Add gettimeofday() call

Provide an implementation of gettimeofday().  This uses clock_gettime()
with the CLOCK_REALTIME parameter, which is currently unimplemented, but
will allow clients to call this function once this functionality has
been implemented.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2018-05-23 11:13:50 -06:00 committed by Anas Nashif
commit e0dda1b4b0
3 changed files with 30 additions and 0 deletions

View file

@ -20,6 +20,11 @@ struct itimerspec {
struct timespec it_value; /* Timer expiration */
};
struct timeval {
signed int tv_sec;
signed int tv_usec;
};
#include <kernel.h>
#include <errno.h>
#include "sys/types.h"
@ -63,6 +68,8 @@ int timer_gettime(timer_t timerid, struct itimerspec *its);
int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
struct itimerspec *ovalue);
int gettimeofday(struct timeval *tv, const void *tz);
#ifdef __cplusplus
}
#endif