Set the time and date
#include <sys/time.h>
int settimeofday( const struct timeval *when,
void *not_used );
libc
This function sets the time and date to the values stored in the structure pointed to by when.
The not_used pointer must be NULL or the behavior of settimeofday() is unspecified. It's provided only for backwards compatibility.
0, or -1 if an error occurred (errno is set).
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
The settimeofday() function is provided for compatibility with existing Unix code. It shouldn't be used in new code -- use clock_settime().
asctime(), asctime_r(), clock_gettime(), clock_settime(), ctime(), ctime_r(), difftime(), gettimeofday(), gmtime(), gmtime_r(), localtime(), localtime_r(), time()