@Test public void testRightNowVariance() throws Exception { PrettyTime t = new PrettyTime(new Date(0)); Assert.assertEquals("moments from now", t.format(new Date(600))); }
public String format(Date then) { if (then == null) then = now(); Duration d = approximateDuration(then); return format(d); }
PrettyTime { public String format(Date then) { if (then == null) then = now(); Duration d = approximateDuration(then); return format(d); } }
PrettyTime { public String format(Date then) { if (then == null) then = now(); Duration d = approximateDuration(then); return format(d); } PrettyTime();  PrettyTime(String overrideResourceBundle);  PrettyTime(final Date reference);  PrettyTime(final Date reference, String overrideResourceBundle);  PrettyTime(final Locale locale);  PrettyTime(final Locale locale, String overrideResourceBundle);  PrettyTime(final Date reference, final Locale locale);  PrettyTime(final Date reference, final Locale locale, String overrideResourceBundle); }
PrettyTime { public String format(Date then) { if (then == null) then = now(); Duration d = approximateDuration(then); return format(d); } PrettyTime();  PrettyTime(String overrideResourceBundle);  PrettyTime(final Date reference);  PrettyTime(final Date reference, String overrideResourceBundle);  PrettyTime(final Locale locale);  PrettyTime(final Locale locale, String overrideResourceBundle);  PrettyTime(final Date reference, final Locale locale);  PrettyTime(final Date reference, final Locale locale, String overrideResourceBundle); Duration approximateDuration(Date then); List<Duration> calculatePreciseDuration(Date then); String format(Date then); String format(Calendar then); String format(final Duration duration); String format(final List<Duration> durations); String formatUnrounded(Date then); String formatUnrounded(Calendar then); String formatUnrounded(Duration duration); String formatUnrounded(List<Duration> durations); String formatDuration(Date then); String formatDuration(Calendar then); String formatDuration(Duration duration); String formatDuration(final List<Duration> durations); String formatDurationUnrounded(Date then); String formatDurationUnrounded(Calendar then); String formatDurationUnrounded(Duration duration); String formatDurationUnrounded(final List<Duration> durations); TimeFormat getFormat(TimeUnit unit); Date getReference(); PrettyTime setReference(final Date timestamp); List<TimeUnit> getUnits(); @SuppressWarnings("unchecked") UNIT getUnit(final Class<UNIT> unitType); PrettyTime registerUnit(final TimeUnit unit, TimeFormat format); TimeFormat removeUnit(final Class<UNIT> unitType); TimeFormat removeUnit(final TimeUnit unit); Locale getLocale(); PrettyTime setLocale(Locale locale); @Override String toString(); List<TimeUnit> clearUnits(); }
PrettyTime { public String format(Date then) { if (then == null) then = now(); Duration d = approximateDuration(then); return format(d); } PrettyTime();  PrettyTime(String overrideResourceBundle);  PrettyTime(final Date reference);  PrettyTime(final Date reference, String overrideResourceBundle);  PrettyTime(final Locale locale);  PrettyTime(final Locale locale, String overrideResourceBundle);  PrettyTime(final Date reference, final Locale locale);  PrettyTime(final Date reference, final Locale locale, String overrideResourceBundle); Duration approximateDuration(Date then); List<Duration> calculatePreciseDuration(Date then); String format(Date then); String format(Calendar then); String format(final Duration duration); String format(final List<Duration> durations); String formatUnrounded(Date then); String formatUnrounded(Calendar then); String formatUnrounded(Duration duration); String formatUnrounded(List<Duration> durations); String formatDuration(Date then); String formatDuration(Calendar then); String formatDuration(Duration duration); String formatDuration(final List<Duration> durations); String formatDurationUnrounded(Date then); String formatDurationUnrounded(Calendar then); String formatDurationUnrounded(Duration duration); String formatDurationUnrounded(final List<Duration> durations); TimeFormat getFormat(TimeUnit unit); Date getReference(); PrettyTime setReference(final Date timestamp); List<TimeUnit> getUnits(); @SuppressWarnings("unchecked") UNIT getUnit(final Class<UNIT> unitType); PrettyTime registerUnit(final TimeUnit unit, TimeFormat format); TimeFormat removeUnit(final Class<UNIT> unitType); TimeFormat removeUnit(final TimeUnit unit); Locale getLocale(); PrettyTime setLocale(Locale locale); @Override String toString(); List<TimeUnit> clearUnits();  }