UniRec
2.9.3
|
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) |
#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)) |
#define ur_time_from_sec_nsec | ( | sec, | |
nsec | |||
) | (ur_time_t) (((uint64_t) (sec) << 32) | (((uint64_t) (nsec) * UR_TIME_NSEC_TO_FRAC) >> 32)) |
#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)) |
#define ur_time_get_msec | ( | time | ) | (uint32_t) (ur_time_get_nsec(time) / 1000000) |
#define ur_time_get_nsec | ( | time | ) | (uint32_t) ((((uint64_t) (time) & 0xffffffff) * 1000000000ULL + 0xffffffff) >> 32) |
#define ur_time_get_sec | ( | time | ) | (uint32_t) ((uint64_t) (time) >> 32) |
#define ur_time_get_usec | ( | time | ) | (uint32_t) (ur_time_get_nsec(time) / 1000) |
#define UR_TIME_NSEC_TO_FRAC 0x44B82FA0AULL |
typedef uint64_t ur_time_t |
uint8_t ur_time_from_string | ( | ur_time_t * | ur, |
const char * | str | ||
) |
Convert string value str into UniRec time ur.
[out] | ur | Target pointer to store result. |
[in] | str | String in the following format: 2018-06-27T16:52:54 or 2018-06-27T16:52:54.500, str may end with "Z" (2018-06-27T16:52:54Z or 2018-06-27T16:52:54.500Z) indicating UTC timezone explicitly. UTC is recommended and should be used in any case. |