amino  1.0-beta2
Lightweight Robot Utility Library
time.h File Reference
#include <errno.h>

Go to the source code of this file.

Macros

#define AA_CLOCK   0
 Set the clock to something if we don't have CLOCK_MONOTONIC.
 

Functions

static struct timespec aa_tm_make (time_t sec, long nsec)
 create a struct timespec with given elements
 
static struct timespec aa_tm_make_norm (time_t sec, long nsec)
 create a struct timespec with given elements, fixing things up if nsec is negative or more than a billion
 
static struct timespec aa_tm_add (struct timespec t1, struct timespec t0)
 add two times: a + b
 
static struct timespec aa_tm_sub (const struct timespec a, const struct timespec b)
 subtract two times: a - b
 
AA_API struct timespec aa_tm_now ()
 gets current time via AA_CLOCK
 
static struct timespec aa_tm_future (const struct timespec reltime)
 returns reltime + now
 
static long aa_tm_cmp (const struct timespec t1, const struct timespec t2)
 t1 < t2: negative; t1 == t2: 0; t1 > t2: positive
 
static struct timespec aa_tm_min (const struct timespec t1, const struct timespec t2)
 Return the earlier of t1, t2.
 
static struct timespec aa_tm_max (const struct timespec t1, const struct timespec t2)
 Return the latter of t1, t2.
 
static int aa_tm_isafter (const struct timespec abstime)
 is the current time later than abstime?
 
static int64_t aa_tm_timespec2usec (const struct timespec t)
 convert timespec t to microseconds
 
static int64_t aa_tm_timespec2msec (const struct timespec t)
 convert timespec t to milliseconds
 
static double aa_tm_timespec2sec (const struct timespec t)
 convert timespec t to seconds
 
static struct timespec aa_tm_sec2timespec (double t)
 convert seconds t to timespec
 
static int aa_tm_relsleep (struct timespec t)
 sleep for specified time