Converts a binary timestamp to an ASCII string that represents an arbitrary time zone. Format #include <utc.h> int utc_ascanytime(*cp, stringlen, *utc) char *cp; size_t stringlen; const utc_t *utc;
1 – Parameters
Input stringlen The length of the cp buffer. utc Binary timestamp. Output cp ASCII string that represents the time.
2 – Description
The ASCII Any Time routine converts a binary timestamp to an ASCII string that expresses a time. The TDF component in the timestamp determines the local time used in the conversion.
3 – Returns
0 Indicates that the routine executed successfully. -1 Indicates an invalid time parameter or invalid results.
4 – Example
The following example converts a time to an ASCII string that expresses the time in the time zone where the timestamp was generated. utc_t evnt; char localTime[UTC_MAX_STR_LEN]; /* * Assuming that evnt contains the timestamp to convert, convert * the time to ASCII in the following format: * * 1991-04-01-12:27:38.37-8:00I2.00 */ utc_ascanytime(localtime, /* Out: Converted time */ UTC_MAX_STR_LEN, /* In: Length of string */ &evnt); /* In: Time to convert */
5 – Related Functions
utc_ascgmtime, utc_asclocaltime