I personally don’t need any finer precision than milliseconds when operating with DateTime
s but I don’t like that various operations with Micro- and Nanoseconds are available without throwing a warning. Its feels like wrong advertising. If Julia allows to add periods to dates the result is expected to be accurate or the operation should error.
Imagine operations on String
s silently taking away a couple of chars because of limitations in the internal implementation. There would be no discussion that this isn’t the right behaviour.
It is also not coherent to allow operations with hidden truncating given that:
- Addition of
Millisecond
s andNanosecond
s result in aCompoundPeriod
without losing accuracy:
julia> Millisecond(1) + Nanosecond(1)
1 millisecond, 1 nanosecond
- Operations on periods alone do throw
InexactError
:
julia> Millisecond(1) / 2
ERROR: InexactError: Int64(0.5)