Exemple #1
0
def test_time_from_longdouble(scale, i_f):
    i, f = i_f
    t = Time(val=i, val2=f, format="mjd", scale=scale)
    ld = np.longdouble(i) + np.longdouble(f)
    assert (
        abs(time_from_longdouble(ld, format="mjd", scale=scale) - t).to(u.ns) < 1 * u.ns
    )
Exemple #2
0
def test_time_from_mjd_string_versus_longdouble_tai(i_f):
    i, f = i_f
    m = np.longdouble(i) + np.longdouble(f)
    s = str(m)
    assert (abs(
        time_from_mjd_string(s, scale="tai") -
        time_from_longdouble(m, scale="tai")).to(u.ns) < 1 * u.ns)
Exemple #3
0
def test_time_from_mjd_string_versus_longdouble_utc(format, i_f):
    i, f = i_f
    m = np.longdouble(i) + np.longdouble(f)
    s = str(m)
    assert (abs(
        time_from_mjd_string(s, scale="utc", format=format) -
        time_from_longdouble(s, scale="utc", format=format)).to(u.ns) <
            1 * u.ns)
Exemple #4
0
def test_time_from_longdouble_utc(format, i_f):
    i, f = i_f
    assume(not (format == "pulsar_mjd" and i in leap_sec_days and
                (1 - f) * 86400 < 1e-9))
    t = Time(val=i, val2=f, format=format, scale="utc")
    ld = np.longdouble(i) + np.longdouble(f)
    assert (abs(time_from_longdouble(ld, format=format, scale="utc") - t).to(
        u.ns) < 1 * u.ns)