xref: /minix3/minix/lib/libc/sys/settimeofday.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #include <sys/cdefs.h>
2*433d6423SLionel Sambuc #include <lib.h>
3*433d6423SLionel Sambuc #include "namespace.h"
4*433d6423SLionel Sambuc 
5*433d6423SLionel Sambuc #include <sys/time.h>
6*433d6423SLionel Sambuc #include <time.h>
7*433d6423SLionel Sambuc 
settimeofday(const struct timeval * tp,const void * tzp)8*433d6423SLionel Sambuc int settimeofday(const struct timeval *tp, const void *tzp)
9*433d6423SLionel Sambuc {
10*433d6423SLionel Sambuc 	struct timespec ts;
11*433d6423SLionel Sambuc 
12*433d6423SLionel Sambuc 	ts.tv_sec = tp->tv_sec;
13*433d6423SLionel Sambuc 	ts.tv_nsec = tp->tv_usec * 1000;
14*433d6423SLionel Sambuc 
15*433d6423SLionel Sambuc 	/* Ignore time zones */
16*433d6423SLionel Sambuc 	return clock_settime(CLOCK_REALTIME, &ts);
17*433d6423SLionel Sambuc }
18*433d6423SLionel Sambuc 
19*433d6423SLionel Sambuc #if defined(__minix) && defined(__weak_alias)
20*433d6423SLionel Sambuc __weak_alias(settimeofday, __settimeofday50)
21*433d6423SLionel Sambuc #endif
22