X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetTimesAjaxPage.java;h=f90806a04f7ec660b94360c076ba7190dedc45f8;hb=c5e641893a2656ebf2c2c8c369fe75eaf3061b52;hp=b17e4a2f971be65d942ed4ded4471f7b764e8c05;hpb=9241deba04f8af154c991b444aa5319bee3b01ab;p=Sone.git 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..f90806a 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; @@ -239,6 +256,14 @@ public class GetTimesAjaxPage extends JsonPage { return refresh; } + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return text; + } + } }