timestamp

timestamp — sets the time resolution for each line.

Syntax

(timestamp mode [label ...])
    

Arguments

mode

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.

label

An optional log or group label.

Returns

On success, t, otherwise one of the following error messages:

(error "textlog: Timestamp must be one of 'first', 'last' or 'average'")
(error "textlog: Group or log label does not exist")
(error "textlog: Too few arguments to timestamp: # < #")
(error "textlog: Invalid command: timestamp")

or, if none of the above errors apply, nil.

Description

The timestamp command lets you set the time resolution for each line. If no label is 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 command corresponds to the Cogent C API function LG_Timestamp.

See Also

tolerance

Example

(timestamp last)
(timestamp first min_ht)