astropy/astropy — pull request #2077 by mhvk (2014-02-13 02:17:29+00:00)
Title: UT1->UTC conversion wrong on leap seconds

@taldcroft - while working further on test cases for #1932 I noticed that the conversion of UT1 to UTC is wrong at the moment of a leap second:
```
from astropy.time import Time, TimeDelta
utc = Time(['2012-07-01 00:00:00.000'], scale='utc')
utc.ut1
#
# this is correct
utc.ut1.utc
#
# round-trip is correct too, as interpolated `delta_ut1_utc` is reused
ut1 = Time('2012-07-01 00:00:00.413', scale='ut1')
ut1.utc
#
# this is wrong; delta_ut1_utc is interpolated at the wrong second
Time(['2012-06-30 23:59:59.413', '2012-07-01 00:00:00.413'], scale='ut1').utc
#
# the problem in a nutshell
```
The problem is that the IERS table is searched with `self._time.jd1, self._time.jd2` both for UTC->UT1 (which is correct) and for `UT1->UTC` (which is not). So, `Time` needs to pass on the `scale` to `iers`, which means changing `_set_scale`, to pass on the scale to `_get_delta_ut1_utc`, and changing the latter to pass it on further to `iers`.

Will try to do this later, but thought I would raise the issue now in case you have a cleverer idea.