Convert time interval to seconds?


#1
T0 = now()
T = now() - T0
typeof(T)
Base.Dates.Millisecond

If I want to convert to seconds, I can do

convert(Float64, (now() - T0).value)/1000

Well, that’s ugly, and depends on knowing that the time period happens to be milliseconds. Is there a better way?


#2

Perhaps tosecond{T}(t::T) = t / convert(T, Base.Dates.Second(1))?


#3

Nice! Maybe should be included in DateTimes, or added to docs