OSDN Git Service

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