Skip to contents

Creates comparison levels based on the absolute difference between two datetime (timestamp) values. Thresholds should use the unit helpers seconds(), minutes(), hours(), days(), months(), or years() for self-documenting, unit-safe specifications. Bare numerics are interpreted as seconds.

Usage

cl_time_diff(...)

Arguments

...

Duration thresholds created by seconds(), minutes(), hours(), days(), months(), or years(), ordered from strictest to most lenient.

Value

A comparison-level object for use in il_compare().

Details

This extends cl_date_diff() to support sub-day precision for timestamp columns. Use cl_date_diff() for date-only columns.

Examples

il_spec() |>
  il_compare(timestamp, cl_time_diff(minutes(5), hours(1)))
#> Linkage Specification
#>   Comparisons (1):
#>     timestamp : time_diff
#>   Blocking rules: (none)

# Mix units freely
il_spec() |>
  il_compare(timestamp, cl_time_diff(seconds(30), minutes(10), hours(2)))
#> Linkage Specification
#>   Comparisons (1):
#>     timestamp : time_diff
#>   Blocking rules: (none)