The ts_elem() function

The ts_elem() function returns an element from the time series at the given time.

Syntax

ts_tselem 
ts_elem(ts_tsdesc   *tsdesc, 
         mi_datetime *tstamp, 
         mi_integer  *STATUS, 
         mi_integer  *off)
tsdesc
The time series descriptor returned by ts_open().
tstamp
A pointer to the time stamp for the desired element.
STATUS
Set on return to indicate whether the element is NULL or hidden. See The ts_hide_elem() function for an explanation of the isNull argument.
off
For regular time series, off is set to the offset on return. If the time series is irregular, or if the time stamp is not in the calendar, off is set to -1. The offset can be NULL.

Description

On return, off is filled in with the offset of the element for a regular time series or -1 for an irregular time series. The element is overwritten after two calls to fetch elements using this tsdesc (time series descriptor).

The equivalent SQL function is GetElem.

Returns

An element, its offset, and whether it is hidden, NULL, or both. This element must not be freed by the caller.