43 #define MAX_UNIT_LABELS 3 79 if (*unit_labels[i].
values[j] && !strncasecmp(unit, unit_labels[i].
values[j],
80 strlen(unit_labels[i].
values[j]))) {
81 return unit_labels[i].
unit;
91 return tv->tv_sec * 1000000 + tv->tv_usec;
Time-related functions and macros.
TIME_UNIT
Time units enumeration.
const char * week_labels[]
ast_suseconds_t ast_time_tv_to_usec(const struct timeval *tv)
Convert a timeval structure to microseconds.
static struct timeval normalize_and_create(unsigned long usec)
Create a timeval first onverting the given microsecond value into seconds and microseconds.
struct timeval ast_time_create_by_unit(unsigned long val, enum TIME_UNIT unit)
Convert the given unit value, and create a timeval object from it.
const char * day_labels[]
enum TIME_UNIT ast_time_str_to_unit(const char *unit)
Convert a string to a time unit enumeration value.
const char * minute_labels[]
struct timeval ast_time_create_by_unit_str(unsigned long val, const char *unit)
Convert the given unit value, and create a timeval object from it.
const char * year_labels[]
const char * month_labels[]
const char * nanosecond_labels[]
const unsigned int unit_labels_size
const char * millisecond_labels[]
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
const char * hour_labels[]
const char * second_labels[]
struct timeval ast_time_create(ast_time_t sec, ast_suseconds_t usec)
Create a timeval object initialized to given values.
static struct time_unit_labels unit_labels[]
const char * microsecond_labels[]