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

Question on tai to utc conversion #99

Open
timweckx opened this issue Oct 13, 2023 · 1 comment
Open

Question on tai to utc conversion #99

timweckx opened this issue Oct 13, 2023 · 1 comment

Comments

@timweckx
Copy link

In eraTaiutc, there is an iteration block that calls back to eraUtctai to get the leap seconds deltas. In the iteration, the deltas for both arguments are added to the 2nd argument. Should the first delta be applied to the first argument?

/* Iterate (though in most cases just once is enough). */
   for ( i = 0; i < 3; i++ ) {

   /* Guessed UTC to TAI. */
      j = eraUtctai(u1, u2, &g1, &g2);
      if ( j < 0 ) return j;

   /* Adjust guessed UTC. */
      u2 += a1 - g1;    --> should this be u1 += a1 - g1
      u2 += a2 - g2;
   }

In practice, I think the first delta is always zero so it doesn't affect the actual values.

@mhvk
Copy link
Contributor

mhvk commented Oct 13, 2023

Thanks for the question! As you noticed, in general g1 and g2 are both small. Since u1 is normally a much larger number, than u1 adding to u1 thus risks rounding errors.

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