This function converts between chronons measured in different time granules.
It is used internally for converting between different continuous time types,
and is particularly useful for efficiently converting between irregular time
granules. The default method uses chronon_cardinality() to cast between
time granules, which is efficient for regular time granules.
Value
An list of two elements:
div: integer vector of chronons measured in thetotime granule.mod: integer vector of the remainder (infromtime granule) after converting to thetotime granule.
Examples
# Convert day 16 after epoch (1970-01-01) into weeks since epoch (and remainder days)
with(cal_isoweek, chronon_divmod(day(1L), week(1L), 16L))
#> $div
#> [1] 2
#>
#> $mod
#> [1] 5
#>
# Convert week 4 after epoch (1970-W1) into days since epoch
with(cal_isoweek, chronon_divmod(week(1L), day(1L), 4L))
#> $div
#> [1] 25
#>
#> $mod
#> [1] 0
#>