1 /*
2  * stime() for uClibc
3  *
4  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5  *
6  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7  */
8 
9 #include <sys/syscall.h>
10 
11 #ifdef __USE_SVID
12 # include <time.h>
13 # ifdef __NR_stime
14 _syscall1(int, stime, const time_t *, t)
15 # elif defined __USE_BSD && defined __NR_settimeofday
16 #  define __need_NULL
17 #  include <stddef.h>
18 #  include <errno.h>
19 #  include <sys/time.h>
20 int stime(const time_t *when)
21 {
22 	struct timeval tv;
23 
24 	if (when == NULL) {
25 		__set_errno(EINVAL);
26 		return -1;
27 	}
28 	tv.tv_sec = *when;
29 	tv.tv_usec = 0;
30 	return settimeofday(&tv, (struct timezone *) 0);
31 }
32 # endif
33 # if defined __NR_stime || (defined __USE_BSD && defined __NR_settimeofday)
34 libc_hidden_def(stime)
35 # endif
36 #endif
37