MobilityDB  1.0

◆ tsequence_find_timestamp()

int tsequence_find_timestamp ( const TSequence seq,
TimestampTz  t 
)

Returns the index of the segment of the temporal sequence value containing the timestamp using binary search.

If the timestamp is contained in the temporal value, the index of the segment containing the timestamp is returned in the output parameter. For example, given a value composed of 3 sequences and a timestamp, the value returned in the output parameter is as follows:

0 1 2 3
|-----|-----|-----|
1) t^ => result = -1
2) t^ => result = 0 if the lower bound is inclusive, -1 otherwise
3) t^ => result = 1
4) t^ => result = 1
5) t^ => result = -1
Parameters
[in]seqTemporal sequence value
[in]tTimestamp
Returns
Returns -1 if the timestamp is not contained in the temporal value