current plus
1 relative to
radix.
odometer(current, radix)
ith element is
always non-negative and less than
radix[i].
The first element of
current is incremented; if it reaches
radix[1]
it is reset to zero and the second element of
current is incremented, and
so on.
On the first call to
odometer,
current should generally be all zeros.
odometer
will return all zeros when it has completed its cycle.
odometer(c(2, 1, 3), c(3, 3, 5)) # returns c(0, 2, 3)
# a function that returns the next second
# in seconds, minutes, hours
next.second <- function(current.time)
odometer(current.time, c(60, 60, 24))