Converts a null-terminated character string that represents a relative timestamp to a binary timestamp. Format #include <utc.h> int utc_mkascreltime(*utc, *string) utc_t *utc; char *string;
1 – Parameters
Input string A null-terminated string that expresses a relative timestamp in its ISO format. Output utc Resulting binary timestamp.
2 – Description
The Make ASCII Relative Time routine converts a null-terminated string, which represents a relative timestamp, to a binary timestamp.
3 – Notes
The ASCII string must be null-terminated.
4 – Returns
0 Indicates that the routine executed successfully. -1 Indicates an invalid time parameter or invalid results.
5 – Example
The following example converts an ASCII relative time string to its binary equivalent. utc_t utc; char str[UTC_MAX_STR_LEN]; /* * Relative time of 333 days, 12 hours, 1 minute, 37.223 seconds * Inaccuracy of 50.22 sec. in the format: -333-12:01:37.223I50.22 */ (void)strcpy((void *)str, "-333-12:01:37.223I50.22"); utc_mkascreltime(&utc, /* Out: Binary utc */ str); /* In: String */
6 – Related Functions
utc_ascreltime