timex.h File Reference

Utility library for comparing and computing timestamps. More...

Detailed Description

Utility library for comparing and computing timestamps.

Definition in file timex.h.

#include <stdint.h>
#include <inttypes.h>
+ Include dependency graph for timex.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  timex_t
 A timex timestamp. More...
 

Macros

#define US_PER_SEC   (1000000LU)
 The number of microseconds per second.
 
#define SEC_PER_MIN   (60LU)
 The number of seconds per minute.
 
#define CS_PER_SEC   (100LU)
 The number of centiseconds per second.
 
#define MS_PER_SEC   (1000LU)
 The number of milliseconds per second.
 
#define US_PER_MS   (1000LU)
 The number of microseconds per millisecond.
 
#define US_PER_CS   (10000U)
 The number of microseconds per centisecond.
 
#define NS_PER_US   (1000LU)
 The number of nanoseconds per microsecond.
 
#define NS_PER_SEC   (1000000000U)
 The number of nanoseconds per second.
 
#define TIMEX_MAX_STR_LEN   (20)
 The maximum length of the string representation of a timex timestamp.
 

Functions

timex_t timex_add (const timex_t a, const timex_t b)
 Adds two timestamps. More...
 
timex_t timex_sub (const timex_t a, const timex_t b)
 Subtracts two timestamps. More...
 
timex_t timex_set (uint32_t seconds, uint32_t microseconds)
 Initializes a timex timestamp. More...
 
int timex_cmp (const timex_t a, const timex_t b)
 Compares two timex timestamps. More...
 
static void timex_normalize (timex_t *time)
 Corrects timex structure so that microseconds < 1000000. More...
 
static int timex_isnormalized (const timex_t *time)
 Tests a timex timestamp for normalization. More...
 
static uint64_t timex_uint64 (const timex_t a)
 Converts a timex timestamp to a 64 bit value. More...
 
static timex_t timex_from_uint64 (const uint64_t timestamp)
 Converts a 64 bit value of microseconds to a timex timestamp. More...
 
const char * timex_to_str (timex_t t, char *timestamp)
 Converts a timex timestamp to a string. More...