The ts_last_elem() function

The ts_last_elem() function returns the last element from a time series.

Syntax

ts_tselem 
ts_last_elem(ts_tsdesc *tsdesc, 
              mi_integer *STATUS, 
              mi_integer *off)
tsdesc
The descriptor for a time series returned by ts_open().
STATUS
A pointer to a mi_integer value. See The ts_hide_elem() function for a description of STATUS.
off
If the time series is regular, off is set to the offset of the returned element. If the time series is irregular, or if the time series is empty, off is set to -1. This argument can be passed in as NULL.

Description

This function fills in off with the element's offset if off is not NULL and the time series is regular, and it sets STATUS to indicate if the element is NULL or hidden.

The equivalent SQL function is GetLastElem.

Returns

The last element of the specified time series, its offset, and whether it is NULL or hidden. If the time series is irregular, the offset is set to -1. This value must not be freed by the caller. The element is overwritten after two calls to fetch elements with this tsdesc (time series descriptor).