Skip to content

Custom Time Scale inside module #66

@zsoerenm

Description

@zsoerenm

If I define a custom time scale inside a package, conversion will not work:

module FooBar

using AstroTime

@timescale GPSTime TAI
AstroTime.Epochs.getoffset(
    ::GPSTimeScale, 
    ::InternationalAtomicTime, 
    second, 
    fraction) = 19
AstroTime.Epochs.getoffset(
    ::InternationalAtomicTime, 
    ::GPSTimeScale, 
    second, 
    fraction) = -19

end

Note that when copying this into the REPL, it will actually work. It does not work when it is a real package (not a module inside Main).
I get the following error:

julia> using FooBar, AstroTime
julia> TAIEpoch(FooBar.GPSTimeEpoch(2021,5,31))
ERROR: No conversion path between 'GPSTime' and 'TAI' available.
Stacktrace:
 [1] apply_offset
   @ ~/.julia/packages/AstroTime/944cN/src/Epochs/offsets.jl:154 [inlined]
 [2] (TAIEpoch{T} where T)(ep::Epoch{IGS.GPSTimeScale, Float64})
   @ AstroTime.Epochs ~/.julia/packages/AstroTime/944cN/src/Epochs/offsets.jl:39
 [3] top-level scope
   @ REPL[3]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions