![]() |
![]() |
![]() |
![]() |
clock_getcpuclockid()
Return the clock ID of the CPU-time clock from a specified process
Synopsis:
#include <sys/types.h>
#include <time.h>
extern int clock_getcpuclockid(
pid_t pid,
clockid_t* clock_id );
Arguments:
- pid
- The process ID for the process whose clock ID you want to get.
- clock_id
- A pointer to a clockid_t object where the function can store the clock ID.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The clock_getcpuclockid() function returns the clock ID of the CPU-time clock of the process specified by pid. If the process described by pid exists and the calling process has permission, the clock ID of this clock is stored in clock_id.
If pid is zero, the clock ID of the CPU-time clock of the process marking the call is returned in clock_id.
A process always has permission to obtain the CPU-time clock ID of another process.
The supported clock IDs include:
- CLOCK_REALTIME — the standard POSIX-defined clock. Timers based on this clock wake up the processor if it's in a power-saving mode.
- CLOCK_SOFTTIME — this clock is active only when
the processor isn't in a power-saving mode.
For example, an application using a CLOCK_SOFTTIME timer
to sleep wouldn't wake up
the processor when the application was due to wake up.
This will allow the processor to enter a power-saving mode.
While the processor isn't in a power-saving mode, CLOCK_SOFTTIME behaves the same as CLOCK_REALTIME.
- CLOCK_MONOTONIC — this clock always increases at a constant rate and can't be adjusted.
Returns:
Zero for success, or an error value.
Errors:
- ESRCH
- No process can be found corresponding to the specified pid.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
See also:
clock_getres(), clock_gettime(), ClockId(), clock_settime(), pthread_getcpuclockid(), timer_create()
Clocks, Timers, and Getting a Kick Every So Often chapter of Getting Started with QNX Neutrino
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)