#include <sys/time.h> int Qp0zSetTimeofDay (struct timeval *tp, struct timezone *tzp);
The Qp0zSetTimeofDay() function sets the software clock to the time contained in the timeval structure pointed to by tp. If tzp is not NULL, the time zone information is also set.
The software clock maintains a time that can be set independently of the system clock. It is not integrated with the system and will be removed in a future release. The settimeofday() function should be used instead.
0 | Qp0zSetTimeofDay() was successful. |
-1 | Qp0zSetTimeofDay() was not successful. The errno variable is set to indicate the error. |
If Qp0zSetTimeofDay() is not successful, errno usually indicates one of the following errors. Under some conditions, errno could indicate an error other than those listed here.
[EINVAL] | An invalid parameter was found.
A parameter passed to this function is not valid. |
[EFAULT] | The address used for an argument is not correct.
In attempting to use an argument in a call, the system detected an address that is not valid. While attempting to access a parameter passed to this function, the system detected an address that is not valid. |
[EPERM] | Operation not permitted.
You must have appropriate privileges or be the owner of the object or other resource to do the requested operation. |
[EUNKNOWN] | Unknown system state.
The operation failed because of an unknown system state. See any messages in the job log and correct any errors that are indicated, then retry the operation. |
None.
If the value of the environment variable QIBM_USE_SFWCLK is "N", Qp0zSetTimeofDay() calls settimeofday() to adjust the system clock.
See Code disclaimer information for information pertaining to code examples.
The following example sets the software clock:
#include <sys/time.h> #include <stdio.h> #include <errno.h> int main(int argc, char *argv[]) { struct timeval now; int rc; time.tv_sec=866208142; time.tv_usec=290944; rc=Qp0zSetTimeofDay(&now, NULL); if(rc==0) { printf("Qp0zSetTimeofDay() successful.\n"); } else { printf("Qp0zSetTimeofDay() failed, " "errno = %d\n",errno); return -1; } return 0; }
Qp0zSetTimeofDay() successful.
Top | UNIX-Type APIs | APIs by category |