@Test public void testNegative() throws Exception { TaiUtcConverter tuc = new TaiUtcConverter(); long t = tuc.utcToInstant(new DateTimeComponents(1017, 1, 1, 11, 59, 58, 999)); assertEquals("1017-01-01T11:59:58.999Z", TimeEncoding.toString(t)); }
long utcToInstant(DateTimeComponents dtc) { long day = caldateToMjd(dtc); long s = (long) (dtc.hour * 60 + dtc.minute); s = s * 60 + dtc.second + (day - 40587) * 86400L; int ls = diffTaiUtc; for (int i = timesecs.length - 1; i >= 0; i--) { long u = timesecs[i] - ls + 1; if (s > u) { break; } if ((s < u) || (dtc.second == 60)) { ls--; } } s += ls; return dtc.millisec + 1000 * s; }
TaiUtcConverter { long utcToInstant(DateTimeComponents dtc) { long day = caldateToMjd(dtc); long s = (long) (dtc.hour * 60 + dtc.minute); s = s * 60 + dtc.second + (day - 40587) * 86400L; int ls = diffTaiUtc; for (int i = timesecs.length - 1; i >= 0; i--) { long u = timesecs[i] - ls + 1; if (s > u) { break; } if ((s < u) || (dtc.second == 60)) { ls--; } } s += ls; return dtc.millisec + 1000 * s; } }
TaiUtcConverter { long utcToInstant(DateTimeComponents dtc) { long day = caldateToMjd(dtc); long s = (long) (dtc.hour * 60 + dtc.minute); s = s * 60 + dtc.second + (day - 40587) * 86400L; int ls = diffTaiUtc; for (int i = timesecs.length - 1; i >= 0; i--) { long u = timesecs[i] - ls + 1; if (s > u) { break; } if ((s < u) || (dtc.second == 60)) { ls--; } } s += ls; return dtc.millisec + 1000 * s; } TaiUtcConverter();  TaiUtcConverter(InputStream utcTaiHistory); }
TaiUtcConverter { long utcToInstant(DateTimeComponents dtc) { long day = caldateToMjd(dtc); long s = (long) (dtc.hour * 60 + dtc.minute); s = s * 60 + dtc.second + (day - 40587) * 86400L; int ls = diffTaiUtc; for (int i = timesecs.length - 1; i >= 0; i--) { long u = timesecs[i] - ls + 1; if (s > u) { break; } if ((s < u) || (dtc.second == 60)) { ls--; } } s += ls; return dtc.millisec + 1000 * s; } TaiUtcConverter();  TaiUtcConverter(InputStream utcTaiHistory); static boolean isLeap(final int year); }
TaiUtcConverter { long utcToInstant(DateTimeComponents dtc) { long day = caldateToMjd(dtc); long s = (long) (dtc.hour * 60 + dtc.minute); s = s * 60 + dtc.second + (day - 40587) * 86400L; int ls = diffTaiUtc; for (int i = timesecs.length - 1; i >= 0; i--) { long u = timesecs[i] - ls + 1; if (s > u) { break; } if ((s < u) || (dtc.second == 60)) { ls--; } } s += ls; return dtc.millisec + 1000 * s; } TaiUtcConverter();  TaiUtcConverter(InputStream utcTaiHistory); static boolean isLeap(final int year);  }