From 033339c3bdb173431486dc2802bab0507e2053b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Apr 2011 20:20:35 +0200 Subject: [PATCH] Expose time calculation. --- .../pterodactylus/sone/web/ajax/GetTimesAjaxPage.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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; -- 2.7.4