Operations with time duration

The reason for deleting the post was lack of confidence in the code.
The review below seems better:

using Dates
import Base: / 
/(t::Dates.CompoundPeriod, x::Real) = canonicalize(Dates.CompoundPeriod(Millisecond(round(Int64,Dates.toms(t)/x))))

t = Hour(26) + Minute(3) + Second(5)
t/5
5 hours, 12 minutes, 37 seconds

t = Hour(1) + Minute(5) + Second(2)
t/5
13 minutes, 400 milliseconds

NB: code based on this post and on this one

1 Like