LG_Time

LG_Time — specifies the time format for a log or group.

Syntax

#include <cogent.h>
ST_STATUS LG_Time(IP_Task*  myself,
 IP_Task*  textlog,
 char*  retbuf,
 int  buflen,
 char*  timespec,
 int  nlabels,
 char**  labels);

Arguments

myself

A pointer to this task's IP_Task structure normallly generated by a call to IP_NserveInit.

textlog

A pointer to the Cascade TextLogger's IP_Task structure, normally generated by a call to IP_TaskFindName.

retbuf

A pointer to a character buffer to hold the return from the call.

buflen

The length of retbuf, in bytes.

timespec

A time specification format string, whose options are as follows:

%JThe day of the week (e.g., Mon).
%jThe day of the month [1-31].
%MThe month (e.g., Jan).
%mThe month in the year [1-12].
%yThe year in the century (e.g., 96).
%YThe year with century (e.g., 1996).
%hThe hour in the day [0-23].
%nThe minute in the hour [0-59].
%zThe second in the minute [0-59].
%ZThe seconds since Jan 1, 1970.
%TThe tenths of seconds in second (%z).
%HThe hundredths of seconds in second (%z).
%LThe milliseconds in second (%z).
%UThe microseconds in second (%z).
%NThe nanoseconds in second (%z).
%ASets a global default time spec. This default can be changed at any time, including run-time.
nlabels

The number of labels (log or group names) referenced in the labels argument.

labels

An array of char*, each of which is a pointer to a string containing a log or group name.

Returns

ST_OK on success. Otherwise ST_ERROR, and the retbuf will contain a more detailed error message (see time in the Cascade TextLogger documentation). If the return value is ST_OK, the retbuf may not contain useful information.

Description

This function lets you specify the time format for any log or group. If no labels are specified, this command sets a global default value for all logs and groups. Any specific value always overrides the global definition, regardless of the order in the configuration file or when a command is sent.

You can prepend any printf-style format modifiers to the time spec field names, as appropriate for the field type. Some of these format modifiers will be ignored (e.g., %y and %Y ignore format modifiers). The string-type fields, %J and %M, respond to %s modifiers.

[Note]

Sub-second fields (%T, %L, %U, %N) usually need to be zero-padded to produce readable results, as in %z.%09N.

This function corresponds to the Cascade TextLogger time command.