UniRec  2.9.3
Macros | Typedefs | Functions
ur_time.h File Reference

Types, macros and function for UniRec timestamp format. More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define UR_TIME_NSEC_TO_FRAC   0x44B82FA0AULL
 
#define ur_time_from_sec_nsec(sec, nsec)   (ur_time_t) (((uint64_t) (sec) << 32) | (((uint64_t) (nsec) * UR_TIME_NSEC_TO_FRAC) >> 32))
 Convert seconds and nanoseconds to ur_time_t. More...
 
#define ur_time_from_sec_usec(sec, usec)   (ur_time_t) (((uint64_t) (sec) << 32) | (((uint64_t) (usec) * 1000 * UR_TIME_NSEC_TO_FRAC) >> 32))
 Convert seconds and microseconds to ur_time_t. More...
 
#define ur_time_from_sec_msec(sec, msec)   (ur_time_t) (((uint64_t) (sec) << 32) | (((uint64_t) (msec) * 1000000 * UR_TIME_NSEC_TO_FRAC) >> 32))
 Convert seconds and milliseconds to ur_time_t. More...
 
#define ur_time_get_sec(time)   (uint32_t) ((uint64_t) (time) >> 32)
 Get number of seconds from ur_time_t. More...
 
#define ur_time_get_nsec(time)   (uint32_t) ((((uint64_t) (time) & 0xffffffff) * 1000000000ULL + 0xffffffff) >> 32)
 Get number of nanoseconds from ur_time_t. More...
 
#define ur_time_get_usec(time)   (uint32_t) (ur_time_get_nsec(time) / 1000)
 Get number of microeconds from ur_time_t. More...
 
#define ur_time_get_msec(time)   (uint32_t) (ur_time_get_nsec(time) / 1000000)
 Get number of milliseconds from ur_time_t. More...
 

Typedefs

typedef uint64_t ur_time_t
 Type of timestamps used in UniRec Timestamps in UniRec are stored as number of seconds from Unix epoch in 64bit fixed point number (32bit integral part, 32bit fraction part). More...
 

Functions

static uint64_t ur_timediff (ur_time_t a, ur_time_t b)
 
static uint64_t ur_timediff_us (ur_time_t a, ur_time_t b)
 
static uint64_t ur_timediff_ns (ur_time_t a, ur_time_t b)
 
uint8_t ur_time_from_string (ur_time_t *ur, const char *str)
 

Detailed Description

Types, macros and function for UniRec timestamp format.

Author
Erik Sabik xsabi.nosp@m.k02@.nosp@m.stud..nosp@m.fit..nosp@m.vutbr.nosp@m..cz
Vaclav Bartos ibart.nosp@m.osv@.nosp@m.fit.v.nosp@m.utbr.nosp@m..cz
Tomas Cejka cejka.nosp@m.t@ce.nosp@m.snet..nosp@m.cz
Date
2013
2014
2015

Definition in file ur_time.h.