SYNOPSIS
#include <time.h>
int clock_getres(clockid_t clock_id, struct timespec *res);
int clock_gettime(clockid_t clock_id, struct timespec *tp);
int clock_settime(clockid_t clock_id, const struct timespec *tp);
DESCRIPTION
The
The
The
There are two types of clocks: system-wide clocks that all processes can access and per-process clocks that only have meaning within that process. Details on available clocks for the NuTCRACKER Platform can be found on the api_intro reference page.
The CLOCK_REALTIME clock is the system realtime clock as defined
in time.h. When the
When
Using
Additionally, any new value for the CLOCK_REALTIME clock set
with the
Finally, on the NuTCRACKER Platform, calling
PARAMETERS
- clock_id
-
Specifies the clock on which the
clock_getres() ,clock_gettime() , orclock_settime() function operates.Available clock ID values for the NuTCRACKER Platform can be found on the api_intro reference page. Of these, only CLOCK_REALTIME can be used with the
clock_settime() function. - res
-
Points to the location where
clock_getres() stores the clock resolution retrieved. - tp
-
Points to a timespec structure which is used to store the time value retrieved with
clock_gettime() or which contains the new time value to be set withclock_settime() .
RETURN VALUES
When successful, these function return 0.
Otherwise, these functions return -1 and set errno to the one of the following:
- EFAULT
-
The clock_id parameter is a bad pointer.
- EINVAL
-
The clock_id parameter does not identify a known clock or an invalid value was specified for tp for
clock_settime() . - EPERM
-
The process calling
clock_settime() lacks the appropriate privilege to set the specified clock.
CONFORMANCE
UNIX 03.
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
On the NuTCRACKER Platform,
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
clock_getcpuclockid() ,clock_nanosleep() ,ctime() ,mq_timedreceive() ,mq_timedsend() ,nanosleep() ,pthread_mutex_timedlock() ,sem_timedwait() ,time() ,timer_create() ,timer_getoverrun()
- Miscellaneous:
- struct timespec
PTC MKS Toolkit 10.4 Documentation Build 39.