From: David ‘Bombe’ Roden Date: Thu, 14 Apr 2011 18:20:35 +0000 (+0200) Subject: Expose time calculation. X-Git-Tag: 0.6.2^2~18^2~4 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=033339c3bdb173431486dc2802bab0507e2053b7 Expose time calculation. --- diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java index b17e4a2..c037708 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.java @@ -120,6 +120,23 @@ public class GetTimesAjaxPage extends JsonPage { * @return The formatted age */ private Time getTime(long age) { + return getTime(webInterface, age); + } + + // + // STATIC METHODS + // + + /** + * Returns the formatted relative time for a given age. + * + * @param webInterface + * The Sone web interface (for l10n access) + * @param age + * The age to format (in milliseconds) + * @return The formatted age + */ + public static Time getTime(WebInterface webInterface, long age) { String text; long refresh; if (age < 0) { @@ -179,7 +196,7 @@ public class GetTimesAjaxPage extends JsonPage { * * @author David ‘Bombe’ Roden */ - private static class Time { + public static class Time { /** Number of milliseconds in a second. */ private static final long SECOND = 1000;