libamxc
1.10.3
C Generic Data Containers
|
Data Structures | |
struct | _timestamp |
The timestamp structure (unix epoch time). More... | |
Typedefs | |
typedef struct _timestamp | amxc_ts_t |
The timestamp structure (unix epoch time). More... | |
Functions | |
int | amxc_ts_now (amxc_ts_t *tsp) |
Takes current time as unix epoch time. More... | |
int | amxc_ts_parse (amxc_ts_t *tsp, const char *str, size_t len) |
Transforms the given string in to unix epoch time. More... | |
size_t | amxc_ts_format (const amxc_ts_t *tsp, char *dst, size_t len) |
Transforms unix epoch time to a string. More... | |
size_t | amxc_ts_format_precision (const amxc_ts_t *tsp, char *dst, size_t len, int precision) |
Transforms unix epoch time to a string. More... | |
int | amxc_ts_compare (const amxc_ts_t *tsp1, const amxc_ts_t *tsp2) |
Checks if tsp1 comes after tsp2. More... | |
bool | amxc_ts_is_valid (const amxc_ts_t *tsp) |
Checks if a timestamp is valid. More... | |
int | amxc_ts_to_tm_utc (const amxc_ts_t *tsp, struct tm *tmp) |
Converts timestamp in unix epoch time to a struct tm type in UTC time. More... | |
int | amxc_ts_to_tm_local (const amxc_ts_t *tsp, struct tm *tmp) |
Converts timestamp in unix epoch time to a struct tm type in local time. More... | |
int | amxc_ts_to_local (amxc_ts_t *tsp) |
Adds the local time offset to the timestamp structure. More... | |
int | amxc_ts_from_tm (amxc_ts_t *const tsp, struct tm *tmp) |
Converts a broken down time in a struct tm to a timestamp structure. More... | |
typedef struct _timestamp amxc_ts_t |
The timestamp structure (unix epoch time).
Checks if tsp1 comes after tsp2.
tsp1 | a pointer to a timestamp structure |
tsp2 | a pointer to a timestamp structure |
Definition at line 506 of file amxc_timestamp.c.
size_t amxc_ts_format | ( | const amxc_ts_t * | tsp, |
char * | dst, | ||
size_t | len | ||
) |
Transforms unix epoch time to a string.
Transforms unix epoch time to string in RFC3339 compatible format.
Use amxc_ts_format_precision to specify the precision.
tsp | a pointer to a timestamp structure |
dst | a pointer to a string |
len | size of the string buffer |
Definition at line 461 of file amxc_timestamp.c.
size_t amxc_ts_format_precision | ( | const amxc_ts_t * | tsp, |
char * | dst, | ||
size_t | len, | ||
int | precision | ||
) |
Transforms unix epoch time to a string.
Transforms unix epoch time to string in RFC3339 compatible format.
tsp | a pointer to a timestamp structure |
dst | a pointer to a string storing the UTC time |
len | size of the string buffer |
precision | number of digits used to express nanoseconds |
Definition at line 490 of file amxc_timestamp.c.
int amxc_ts_from_tm | ( | amxc_ts_t *const | tsp, |
struct tm * | tmp | ||
) |
Converts a broken down time in a struct tm to a timestamp structure.
Using this function a timestamp structure is initialized using a struct tm as input.
tsp | a pointer to a timestamp structure |
tmp | pointer to struct tm, containing the broken down time. |
Definition at line 574 of file amxc_timestamp.c.
bool amxc_ts_is_valid | ( | const amxc_ts_t * | tsp | ) |
Checks if a timestamp is valid.
tsp | a pointer to a timestamp structure |
Definition at line 527 of file amxc_timestamp.c.
int amxc_ts_now | ( | amxc_ts_t * | tsp | ) |
Takes current time as unix epoch time.
Fills the given amxc_ts_t structure with the current time in seconds from the unix epoch time.
tsp | a pointer to the timestamp structure |
Definition at line 301 of file amxc_timestamp.c.
int amxc_ts_parse | ( | amxc_ts_t * | tsp, |
const char * | str, | ||
size_t | len | ||
) |
Transforms the given string in to unix epoch time.
Transforms the time stored in a string in https://tools.ietf.org/html/rfc3339 format into unix epoch time stored as a struct.
tsp | a pointer to a timestamp structure |
str | string containing time in RFC3339 format |
len | length of the string |
Definition at line 369 of file amxc_timestamp.c.
int amxc_ts_to_local | ( | amxc_ts_t * | tsp | ) |
Adds the local time offset to the timestamp structure.
tsp | a pointer to a timestamp structure |
Definition at line 553 of file amxc_timestamp.c.
int amxc_ts_to_tm_local | ( | const amxc_ts_t * | tsp, |
struct tm * | tmp | ||
) |
Converts timestamp in unix epoch time to a struct tm type in local time.
tsp | a pointer to a timestamp structure |
tmp | a pointer to a struct tm type |
Definition at line 549 of file amxc_timestamp.c.
int amxc_ts_to_tm_utc | ( | const amxc_ts_t * | tsp, |
struct tm * | tmp | ||
) |
Converts timestamp in unix epoch time to a struct tm type in UTC time.
tsp | a pointer to a timestamp structure |
tmp | a pointer to a struct tm type |
Definition at line 545 of file amxc_timestamp.c.