#ifdef HAVE_CONFIG_H #include #endif #include #include #include "../internal/syscall.h" #if VLIBC_LEVEL_GE(2) /* * settimeofday: set the kernel clock, via SYS_settimeofday. * * Requires privilege (the unprivileged caller gets EPERM from the kernel). * The tz argument is honored only alongside tv; passing a timezone record * while tv is NULL would ask the kernel to update its timezone state alone, * a legacy use no caller needs, so it is refused up front with ENOTSUP (the * Linux spelling of the value musl reports here; carries it as * EOPNOTSUPP). */ int settimeofday(const struct timeval *tv, const struct timezone *tz) { if (tz != NULL && tv == NULL) { errno = EOPNOTSUPP; return -1; } return syscall_ret(__syscall2(SYS_settimeofday, (long)tv, (long)tz)); } #endif /* VLIBC_LEVEL_GE(2) */