int status = utc_ctime_to_date(time_t utc_ctime, std::string date, [bool output_utc])
This routine converts a UTC ctime to a std::string having the format
"dd-Mmm-yyyy hh:mm:ss". Please see convert_seconds_c for the
explanation of UTC ctimes, which is just seconds since the Epoch.
The caller may choose to have the result as either a local time (for user
consumption) or UTC time (for database consumption when working with
UTC datetime DB fields).
If the user selects local for the result the following applies:
Because the output is in local time but without an explicit timezone
there is an issue with regard to the duplicated local times that occur
immediately after the transistion back to standard time each Fall.
Like clinks_to_date this routine uses ":" vs. ";" in the time to
distinguish the duplicated times. Please see clinks_to_date.
If the user selects UTC for the result the following applies
All times are unique and the ":" vs. ";" logic is not applicable. With
the absence of the ";" case the format is a valid Sybase date format and
appropriate for a DB field that is intended to maintain its times in
UTC. See intro_database section on time and date in Sybase for details.
utc_ctime a time in UTC ctime
date std::string with result, one may use date.c_str()
to access results as a null terminated C string.
output_utc output UTC iff true (default is false for
similarity with clinks_to_date)
This function returns ACNET status values as follows:
CLIB_CONVERSION_ERROR underlying Linux routines localtime_r or
gmtime_r failed in some way
CLIB_BUGCHK an internal error has occured please contact
controls for a resolution (The expectation is
that the user will never see this error.)
This function requires the following include files:
convert_seconds_c, clinks_to_date, intro_database, timezone_info
time_t utc_ctime = 0;
bool output_utc = true;
status = utc_ctime_to_date(utc_ctime,date,output_utc);
fprintf(stdout,"%d (UTC ctime) is '%s' in UTC ",utc_ctime,date.c_str());