Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Macros | Functions
time.h File Reference
#include <signal.h>
#include <stdint.h>
#include <sys/types.h>
Include dependency graph for time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  timespec
 
struct  itimerspec
 

Macros

#define CLOCK_REALTIME   0
 
#define CLOCK_MONOTONIC   1
 

Functions

int clock_getres (clockid_t clockid, struct timespec *res)
 Get the resolution (precision) of the specified clock ID. More...
 
int clock_gettime (clockid_t clockid, struct timespec *tp)
 Retrieve the time of the specified clock ID. More...
 
int clock_settime (clockid_t clockid, const struct timespec *tp)
 Set the time of the specified clock ID. More...
 
int timer_create (clockid_t clockid, struct sigevent *sevp, timer_t *timerid)
 Create a new per-thread interval timer. More...
 
int timer_delete (timer_t timerid)
 Delete the timer specified with the timer ID. More...
 
int timer_settime (timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec *old_value)
 Arm or disarm the timer specified by the timer ID. More...
 
int timer_gettime (timer_t timerid, struct itimerspec *curr_value)
 Return the timer interval and the time until next expiration. More...
 

Function Documentation

◆ clock_getres()

int clock_getres ( clockid_t  clockid,
struct timespec res 
)

Get the resolution (precision) of the specified clock ID.

Parameters
clk_idThe clock ID to provide.
resThe time object for returning the clock resolution.
Return values
int0 on success and nonzero error number on error.

◆ clock_gettime()

int clock_gettime ( clockid_t  clockid,
struct timespec tp 
)

Retrieve the time of the specified clock ID.

Parameters
clk_idThe clock ID to provide.
tpThe time object for returning the time.
Return values
int0 on success and nonzero error number on error.

◆ clock_settime()

int clock_settime ( clockid_t  clockid,
const struct timespec tp 
)

Set the time of the specified clock ID.

Parameters
clk_idThe clock ID to provide.
tpThe time object for setting the clock.
Return values
int0 on success and nonzero error number on error.

◆ timer_create()

int timer_create ( clockid_t  clockid,
struct sigevent sevp,
timer_t *  timerid 
)

Create a new per-thread interval timer.

Parameters
clk_idThe clock ID to provide.
sevpFor signaling an event when the timer expired.
timeridFor returning the ID of the newly created timer.
Return values
int0 on success and nonzero error number on error.

◆ timer_delete()

int timer_delete ( timer_t  timerid)

Delete the timer specified with the timer ID.

Parameters
timeridThe timer ID to provide.
Return values
int0 on success and nonzero error number on error.

◆ timer_gettime()

int timer_gettime ( timer_t  timerid,
struct itimerspec curr_value 
)

Return the timer interval and the time until next expiration.

Parameters
timeridThe timer ID to provide.
curr_valueThe timer object for returning the timer time.
Return values
int0 on success and nonzero error number on error.

◆ timer_settime()

int timer_settime ( timer_t  timerid,
int  flags,
const struct itimerspec new_value,
struct itimerspec old_value 
)

Arm or disarm the timer specified by the timer ID.

Parameters
timeridThe timer ID to provide.
flagsNot used.
new_valuePointer the the new timer setting.
old_valuePointer to the memory space for storing the old timer setting.
Return values
int0 on success and nonzero error number on error.