Open
Description
openedon Sep 15, 2020
I originally added this as a comment to #29339 but it deserves its own issue.
The parser in Dates
is limited to parsing milliseconds even though Time
and data types in other packages, e.g. AstroTime.jl, support higher precision.
julia> t = Time(12, 12, 12, 123, 456, 789)
12:12:12.123456789
julia> time_str = string(t)
"12:12:12.123456789"
julia> Time(time_str)
ERROR: InexactError: convert(Dates.Decimal3, 123456789)
Stacktrace:
[1] tryparsenext at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/io.jl:153 [inlined]
[2] tryparsenext at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/io.jl:41 [inlined]
[3] macro expansion at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/parse.jl:64 [inlined]
[4] tryparsenext_core(::String, ::Int64, ::Int64, ::DateFormat{Symbol("HH:MM:SS.s"),Tuple{Dates.DatePart{'H'},Dates.Delim{Char,1},Dates.DatePart{'M'},Dates.Delim{Char,1},Dates.DatePart{'S'},Dates.Delim{Char,1},Dates.DatePart{'s'}}}, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/parse.jl:38
[5] macro expansion at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/parse.jl:150 [inlined]
[6] tryparsenext_internal at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/parse.jl:125 [inlined]
[7] parse at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/parse.jl:282 [inlined]
[8] Time at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Dates/src/io.jl:524 [inlined] (repeats 2 times)
[9] top-level scope at REPL[9]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment