PreviousNext

utc_asclocaltime(3dts)

Converts a binary timestamp to an ASCII string that represents a local time

Synopsis

#include <dce/utc.h>

int utc_asclocaltime(
char * cp,
size_t
stringlen,
utc_t *
utc);

Parameters

Input

stringlen
Length of the cp buffer.

utc
Binary timestamp. Use NULL if you want this routine to use the current time for this parameter.

Output

cp
ASCII string that represents the time.

Description
The utc_asclocaltime( ) routine converts a binary timestamp to an ASCII string that expresses local time.

The user's environment determines the time zone rule (details are system dependent). For example, on OSF/1 systems, the user selects a time zone by specifying the TZ environment variable. (The reference information for the localtime( ) system call, which is described in the ctime(3) reference page, provides additional information.)

If the user's environment does not specify a time zone rule, the system's rule is used (details of the rule are system dependent). For example, on OSF/1 systems, the rule in /etc/zoneinfo/localtime applies.

Return Values
~0 Indicates that the routine executed successfully.

1 Indicates an invalid time parameter or invalid results.

Examples
The following example converts the current time to local time.

char localTime[UTC_MAX_STR_LEN];
/* Convert the current time...
*/
utc_asclocaltime(localTime, /* Out: Converted time */
UTC_MAX_STR_LEN, /* In: Length of string */
(utc_t*) NULL); /* In: Time to convert */
/* Default is current time */

Related Information
Functions:

utc_ascanytime(3dts)

utc_ascgmtime(3dts)