TimeUtils { public static boolean timeEscapedOver(long referenceTime, int second) { return ((System.currentTimeMillis() - referenceTime) / 1000F) > (second * 1.0); }  static String formatDateTimeZone(final long timestampMs); static String formatDateTime(final long timestampMs); static long convertDateTimeToUTCMillis(final String dateTime); static String formatDuration(final long startTime, final long endTime); static String formatPeriod(final ReadablePeriod period); static ReadablePeriod parsePeriodString(final String periodStr); static String createPeriodString(final ReadablePeriod period); static boolean timeEscapedOver(long referenceTime, int second); static int daysEscapedOver(long referenceTime);  }
@Test public void testTimeEscapedOver() throws InterruptedException { long baseTime = System.currentTimeMillis(); TimeUnit.SECONDS.sleep(1); Assert.assertTrue( TimeUtils.timeEscapedOver(baseTime, 1)); Assert.assertFalse(TimeUtils.timeEscapedOver(baseTime, 2)); }