'Test that the relevant global time metadata is read into
``Table.meta`` as ``Time``.'

@pytest.mark.parametrize('table_types', (Table, QTable))
def test_fits_to_time_meta(self, table_types):

    t = table_types()
    t['a'] = Time(self.time, format='isot', scale='utc')
    t.meta['DATE'] = '1999-01-01T00:00:00'
    t.meta['MJD-OBS'] = 56670
    t.write(self.temp('time.fits'), format='fits', overwrite=True)
    tm = table_types.read(self.temp('time.fits'), format='fits')
    assert (not isinstance(tm.meta['DATE'], Time))
    assert (tm.meta['DATE'] == t.meta['DATE'])
    assert (not isinstance(tm.meta['MJD-OBS'], Time))
    assert (tm.meta['MJD-OBS'] == t.meta['MJD-OBS'])
    t.write(self.temp('time.fits'), format='fits', overwrite=True, astropy_native=True)
    tm = table_types.read(self.temp('time.fits'), format='fits', astropy_native=True)
    assert isinstance(tm.meta['DATE'], Time)
    assert (tm.meta['DATE'].value == (t.meta['DATE'] + '(UTC)'))
    assert (tm.meta['DATE'].format == 'fits')
    assert (tm.meta['DATE'].scale == 'utc')
    assert isinstance(tm.meta['MJD-OBS'], Time)
    assert (tm.meta['MJD-OBS'].value == t.meta['MJD-OBS'])
    assert (tm.meta['MJD-OBS'].format == 'mjd')
    assert (tm.meta['MJD-OBS'].scale == 'utc')
    t.meta['TIMESYS'] = 'ET'
    t.write(self.temp('time.fits'), format='fits', overwrite=True, astropy_native=True)
    tm = table_types.read(self.temp('time.fits'), format='fits', astropy_native=True)
    assert isinstance(tm.meta['DATE'], Time)
    assert (tm.meta['DATE'].value == (t.meta['DATE'] + '(UTC)'))
    assert (tm.meta['DATE'].scale == 'utc')
    assert isinstance(tm.meta['MJD-OBS'], Time)
    assert (tm.meta['MJD-OBS'].value == t.meta['MJD-OBS'])
    assert (tm.meta['MJD-OBS'].scale == FITS_DEPRECATED_SCALES[t.meta['TIMESYS']])
