taiutc.c | taiutc.c | |||
---|---|---|---|---|
skipping to change at line 86 | skipping to change at line 86 | |||
/* See if the TAI can possibly be in a leap-second day. */ | /* See if the TAI can possibly be in a leap-second day. */ | |||
d1 = a1; | d1 = a1; | |||
dats1 = 0.0; | dats1 = 0.0; | |||
for ( i = -1; i <= 3; i++ ) { | for ( i = -1; i <= 3; i++ ) { | |||
d2 = a2 + (double) i; | d2 = a2 + (double) i; | |||
if ( eraJd2cal(d1, d2, &iy, &im, &id, &fd) ) return -1; | if ( eraJd2cal(d1, d2, &iy, &im, &id, &fd) ) return -1; | |||
js = eraDat(iy, im, id, 0.0, &dats2); | js = eraDat(iy, im, id, 0.0, &dats2); | |||
if ( js < 0 ) return -1; | if ( js < 0 ) return -1; | |||
if ( i == -1 ) dats1 = dats2; | if ( i == -1 ) dats1 = dats2; | |||
ddats = dats2 - dats1; | ddats = dats2 - dats1; | |||
datd = dats1 / DAYSEC; | datd = dats1 / ERFA_DAYSEC; | |||
if ( fabs(ddats) >= 0.5 ) { | if ( fabs(ddats) >= 0.5 ) { | |||
/* Yes. Get TAI for the start of the UTC day that */ | /* Yes. Get TAI for the start of the UTC day that */ | |||
/* ends in a leap. */ | /* ends in a leap. */ | |||
if ( eraCal2jd(iy, im, id, &d1, &d2) ) return -1; | if ( eraCal2jd(iy, im, id, &d1, &d2) ) return -1; | |||
as1 = d1; | as1 = d1; | |||
as2 = d2 - 1.0 + datd; | as2 = d2 - 1.0 + datd; | |||
/* Is the TAI after this point? */ | /* Is the TAI after this point? */ | |||
da = a1 - as1; | da = a1 - as1; | |||
da = da + ( a2 - as2 ); | da = da + ( a2 - as2 ); | |||
if ( da > 0 ) { | if ( da > 0 ) { | |||
/* Yes: fraction of the current UTC day that has elapsed. */ | /* Yes: fraction of the current UTC day that has elapsed. */ | |||
fd = da * DAYSEC / ( DAYSEC + ddats ); | fd = da * ERFA_DAYSEC / ( ERFA_DAYSEC + ddats ); | |||
/* Ramp TAI-UTC to bring about ERFA's JD(UTC) convention. */ | /* Ramp TAI-UTC to bring about ERFA's JD(UTC) convention. */ | |||
datd += ddats * ( fd <= 1.0 ? fd : 1.0 ) / DAYSEC; | datd += ddats * ( fd <= 1.0 ? fd : 1.0 ) / ERFA_DAYSEC; | |||
} | } | |||
/* Done. */ | /* Done. */ | |||
break; | break; | |||
} | } | |||
dats1 = dats2; | dats1 = dats2; | |||
} | } | |||
/* Subtract the (possibly adjusted) TAI-UTC from TAI to give UTC. */ | /* Subtract the (possibly adjusted) TAI-UTC from TAI to give UTC. */ | |||
a2 -= datd; | a2 -= datd; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |