-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I think it would feel very natural to cooperate with the time related quantities of Unitful.jl (possibly as a package extension). It might be worth going through NanoDates.jl's complete API to check whether there are more opportunities, but in the following I'll focus on my specific use case.
A Unitful.Quantity containing time information relative to the Unix epoch needs to be converted to a NanoDate. I currently effectively uconvert it to a specific SI prefix, remove the unit with ustrip and then hand the result to the correct unix*2nanodate. This feels quite an indirect way to combine two packages which both handle time where one package already provides the prefix the other package needs.
I think some definitions like
unix2nanodate(x::Quantity{Int, Unitful.𝐓, Unitful.µs |> typeof}) = x |> ustrip |> unixmicros2nanodatecould hide this API friction. There might be better ways (I do not know Unitful.jl too well), but this should at least work.