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

JDtoGPSTime is not correct? #127

Open
amilagili opened this issue Dec 20, 2023 · 3 comments
Open

JDtoGPSTime is not correct? #127

amilagili opened this issue Dec 20, 2023 · 3 comments

Comments

@amilagili
Copy link

amilagili commented Dec 20, 2023

void JDToGpsTime(double JD, long *GpsRollover, long *GpsWeek, double *GpsSecond)

Hi!

It seems like the function takes in TT time to calculate GPS Time, but the output time is 51.184 seconds ahead ?
Since TT time = GPS Time + 19S + 32.184S, shouldn't this be subtracted?

Thanks a lot

@ericstoneking
Copy link
Owner

Yes, you're right. See recent commit. Let me know if I flubbed the sign.

@amilagili
Copy link
Author

Hi,

Thanks for your commit.
The sign is ok, but it seems there's a loss in precision as a result of the calculation.

Is it correct to think that the JDToGpsTime() function is intended to calculate "the time spent since the GPS epoch(=GPS time) in JD (with the GPS scale), but it is not intended to convert TT to GPS time scale.

Hence, it may be incorrect to pass the TT time (TT.JulDay) to JDToGpsTime(), but rather the GPS time in JD should be passed instead?

For example, I set the simulation start time as 2022-10-30 00:00:00.000, but from the GPS what I read is 2022-10-30 00:00:00.000010~

@ericstoneking
Copy link
Owner

That's roundoff error. I've reduced it by going directly from AtomicTime to GpsTime (which is sec since J2000) to GpsDate (GpsRollover,GpsWeek,GpsSecond). Now the roundoff is about 50 nanoseconds on my machine for dates in the 2020's. If you need better than that, you may want to split GpsSecond into seconds and subseconds.

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

2 participants