MobilityDB 1.1

◆ tdiscseq_find_timestamp()

int tdiscseq_find_timestamp ( const TSequence seq,
TimestampTz  t 
)

Return the index of a timestamp in a temporal discrete sequence value using binary search.

If the timestamp is contained in the temporal discrete sequence, the index of the composing instant is returned in the output parameter. Otherwise, return -1. For example, given a value composed of 3 instants and a timestamp, the value returned in the output parameter is as follows:

0 1 2
| | |
1) t^ => result = -1
2) t^ => result = 0
3) t^ => result = 1
4) t^ => result = 2
5) t^ => result = -1
Parameters
[in]seqTemporal discrete sequence
[in]tTimestamp
Returns
Return true if the timestamp is contained in the discrete sequence