Set the time and date
Synopsis:
#include <sys/time.h>
int settimeofday( const struct timeval *when,
void *not_used );
Arguments:
- when
- A pointer to a timeval structure that specifies
the time that you want to set.
The struct timeval contains the following members:
- time_t tv_sec — the number of
seconds since the start of the Unix Epoch.
- suseconds_t tv_usec — the number of microseconds.
- not_used
- This pointer must be NULL or the behavior of settimeofday() is undefined.
This argument is provided only for backwards compatibility.
Library:
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
Description:
This function sets the time and date to the values stored in the
structure pointed to by when.
Note:
In order to set the clock, your process must have the
PROCMGR_AID_CLOCKSET ability enabled.
For more information, see
procmgr_ability().
Returns:
0, or -1 if an error occurred
(errno is set).
Errors:
- EFAULT
- An error occurred while accessing the when buffer.
- EPERM
- The calling process doesn't have the required permission; see
procmgr_ability().
Classification:
Legacy Unix
Safety: |
|
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
Caveats:
The settimeofday() function is provided for compatibility with
existing Unix code.
You shouldn't use it in new code; use
clock_settime()
instead.