def time_to_longdouble(t):
    """ Return an astropy Time value as MJD in longdouble

    The returned value is accurate to within a nanosecond, while the precision of long
    double MJDs (near the present) is roughly 0.7 ns.

    """
    if t.format.startswith('pulsar_mjd'):
        return t.pulsar_mjd_long
    else:
        return t.mjd_long
