Timestamp generator
The timestamp_sequence() function may be used as a timestamp generator to
create data for testing. Pseudo-random steps can be achieved by providing a
random function to the
step argument. A seed value may be provided to a random function if the
randomly-generated step should be deterministic.
timestamp_sequence#
timestamp_sequence(startTimestamp, step)generates a sequence oftimestampstarting atstartTimestamp, and incrementing by astepset as alongvalue in microseconds. Thisstepcan be either;a static value, in which case the growth will be monotonic, or
a randomized value, in which case the growth will be randomized. This is done using random value generator functions.
Arguments:
startTimestamp: is atimestamprepresenting the starting (i.e lowest) generated timestamp in the sequence.step: is alongrepresenting the interval between 2 consecutive generated timestamps inmicroseconds.
Return value:
Return value type is timestamp.
Examples:
Monotonic timestamp increase
| x | timestamp_sequence |
|---|---|
| 1 | 2019-10-17T00:00:00.000000Z |
| 2 | 2019-10-17T00:00:00.100000Z |
| 3 | 2019-10-17T00:00:00.200000Z |
| 4 | 2019-10-17T00:00:00.300000Z |
| 5 | 2019-10-17T00:00:00.400000Z |
Randomized timestamp increase
| x | timestamp_sequence |
|---|---|
| 1 | 2019-10-17T00:00:00.000000Z |
| 2 | 2019-10-17T00:00:00.100000Z |
| 3 | 2019-10-17T00:00:00.600000Z |
| 4 | 2019-10-17T00:00:00.900000Z |
| 5 | 2019-10-17T00:00:01.300000Z |