cs_time

Description

Retrieves the current date and time.

Syntax

CS_RETCODE cs_time(context, locale, buffer, buflen,
                outlen, daterec)
 
 CS_CONTEXT     *context;
 CS_LOCALE        *locale;
 CS_VOID             *buffer;
 CS_INT                buflen;
 CS_INT                *outlen;
 CS_DATEREC      *daterec;

Parameters

context

A pointer to a CS_CONTEXT structure.

locale

A pointer to a CS_LOCALE structure. A CS_LOCALE structure contains locale information, including formatting information that cs_time uses to create a current datetime string.

locale can be NULL. If locale is NULL, cs_time uses whatever localization information is defined in the CS_CONTEXT structure indicated by context. Localization information is always defined at the context level, because a CS_CONTEXT picks up default localization information when it is allocated.

buffer

A pointer to the space in which cs_time will place a character string representing the current date and time.

buffer is an optional parameter and can be passed as NULL. If buffer is NULL, daterec must be supplied.

buflen

The length, in bytes, of *buffer.

If buffer is supplied and buflen indicates that *buffer is not large enough to hold the current datetime string, cs_time sets *outlen to the length of the datetime string and returns CS_FAIL.

If buffer is NULL, pass buflen as CS_UNUSED.

outlen

A pointer to an integer variable.

cs_time sets *outlen to the length, in bytes, of the current datetime string.

If the string is larger than buflen bytes, an application can use the value of *outlen to determine how many bytes are needed to hold the string.

If buffer is NULL, pass outlen as NULL.

If an application does not care about return length information, it can pass outlen as NULL.

daterec

A pointer to a CS_DATEREC structure in which cs_time will place the current date and time. Note that cs_time does not set the datemsecond and datetzone fields of the CS_DATEREC structure.

For more information on the CS_DATEREC structure, see cs_dt_crack in this chapter.

daterec is an optional parameter and can be passed as NULL. If daterec is NULL, buffer must be supplied.

Returns

cs_time returns:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Common reasons for a cs_time failure include:

Usage

See also

cs_config, cs_dt_crack, cs_dt_info, cs_locale