LG_Timestamp

LG_Timestamp — sets the time resolution for each line.

Syntax

#include <cogent.h>
ST_STATUS LG_Timestamp(IP_Task*  myself,
 IP_Task*  textlog,
 char*  retbuf,
 int  buflen,
 char*  timestamp,
 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.

timestamp

Specifies how the timestamp is to be assigned for each line. One of the following:

first

Sets the timestamp to the time the first point was logged.

last

Sets the timestamp to the time the last point was logged. This is the recommended choice.

average

Sets the timestamp to the average log time of all the points.

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 timestamp in the Cascade TextLogger documentation). If the return value is ST_OK, the retbuf may not contain useful information.

Description

This function lets you set the time resolution for each line. 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.

We recommend setting the timestamp to last, so the lines of output will be written in a non-decreasing order. Of course, this will only be true if the data itself is ordered incrementally by times. Otherwise, you may have to post-process the file and sort it to create a non-decreasing time sequence.

This function corresponds to the Cascade TextLogger timestamp command.