yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame^] | 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 | #include <time.h> |
| 12 | #include <sys/time.h> |
| 13 | |
| 14 | #ifdef __USE_SVID |
| 15 | #ifdef __NR_stime |
| 16 | _syscall1(int, stime, const time_t *, t) |
| 17 | #else |
| 18 | |
| 19 | int stime(const time_t * when) |
| 20 | { |
| 21 | struct timeval tv; |
| 22 | |
| 23 | if (when == NULL) { |
| 24 | __set_errno(EINVAL); |
| 25 | return -1; |
| 26 | } |
| 27 | tv.tv_sec = *when; |
| 28 | tv.tv_usec = 0; |
| 29 | return settimeofday(&tv, (struct timezone *) 0); |
| 30 | } |
| 31 | #endif |
| 32 | #endif |