Documentation

elapsed() function

Flux 0.36.0+

The elapsed() function returns the time between subsequent records. Given an input table, elapsed() returns the same table without the first record (as elapsed time is not defined) and an additional column containing the elapsed time.

elapsed(
  unit: 1s,
  timeColumn: "_time",
  columnName: "elapsed"
)

elapsed() returns an errors if the timeColumn is not present in the input table.

Parameters

unit

The unit time to returned. Default is 1s.

timeColumn

The column to use to compute the elapsed time. Default is "_time".

columnName

The column to store elapsed times. Default is "elapsed".

tables

Input data. Default is piped-forward data (<-).

Examples

The following example uses data provided by the sampledata package to show how elapsed() transforms data.

Calculate the time between points in seconds

import "sampledata"

sampledata.int()
	|> elapsed(unit: 1s)

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.