Skip to content

Commit

Permalink
add doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Nov 5, 2024
1 parent 1ebbc48 commit 56185da
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/period.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ Dates.value(p::Period) = p.duration
__tf((result...,Int64(p)),time2,dn...)
end
end

"""
tf(time,divi)
Recursively divides `time` into the tuple `divi`. For example
```julia
divi = (24*60*60,60*60,60,1)
tf(1234567,divi)
# output
# (14, 6, 56, 7)
# 14 days, 6 hours, 56 minutes, 7 seconds
sum(tf(1234567,divi) .* divi) == 1234567
# output
# true
```
"""
@inline tf(time,divi) = __tf((),time,divi...)

# rescale the time units for the ratio factor/exponent
Expand Down

0 comments on commit 56185da

Please sign in to comment.