new_linear_time_fn() creates a linear time function for a specified
chronon. A chronon is the smallest indivisible time granule (e.g., days,
hours).
Examples
# Linear time with 1 month granules as the chronon
ym <- new_linear_time_fn(month(1L))
ym(Sys.Date())
#> <mixtime[1]>
#> [1] 2026 May
# Linear time with 1 day granules as the chronon
yd <- new_linear_time_fn(day(1L))
yd(Sys.Date())
#> <mixtime[1]>
#> [1] 2026-05-19
# Linear time with 1 week granules as the chronon, using the ISO week calendar
yw <- new_linear_time_fn(week(1L), default_calendar = cal_isoweek)
yw(Sys.Date())
#> <mixtime[1]>
#> [1] 2026 W21
# Linear time with 1 hour granules as the chronon
ymd_h <- new_linear_time_fn(hour(1L))
ymd_h(Sys.time())
#> <mixtime[1]>
#> [1] 2026-05-19 08h