mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
Use clock_settime to implement stime; withdraw stime.
Unconditionally, on all ports, use clock_settime to implement stime, not settimeofday or a direct syscall. Then convert stime into a compatibility symbol and remove its prototype from time.h. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
committed by
Adhemerval Zanella
parent
4a39c34c4f
commit
12cbde1dae
23
time/stime.c
23
time/stime.c
@@ -15,23 +15,24 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <shlib-compat.h>
|
||||
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31)
|
||||
|
||||
#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;
|
||||
}
|
||||
struct timespec ts;
|
||||
ts.tv_sec = *when;
|
||||
ts.tv_nsec = 0;
|
||||
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
return __clock_settime (CLOCK_REALTIME, &ts);
|
||||
}
|
||||
|
||||
stub_warning (stime)
|
||||
compat_symbol (libc, __stime, stime, GLIBC_2_0);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user