-/* Copyright (C) 1992-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31)
-#include <errno.h>
#include <time.h>
-#include <stddef.h>
/* Set the system clock to *WHEN. */
int
-stime (const time_t *when)
+attribute_compat_text_section
+__stime (const time_t *when)
{
- if (when == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- __set_errno (ENOSYS);
- return -1;
+ struct timespec ts;
+ ts.tv_sec = *when;
+ ts.tv_nsec = 0;
+
+ return __clock_settime (CLOCK_REALTIME, &ts);
}
-stub_warning (stime)
+compat_symbol (libc, __stime, stime, GLIBC_2_0);
+#endif