Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Time Scale inside module #66

Open
zsoerenm opened this issue Sep 16, 2021 · 0 comments
Open

Custom Time Scale inside module #66

zsoerenm opened this issue Sep 16, 2021 · 0 comments

Comments

@zsoerenm
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant