Return age of Sone in seconds.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 21 Oct 2010 12:20:16 +0000 (14:20 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 21 Oct 2010 12:20:16 +0000 (14:20 +0200)
src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java

index e5385fa..3f1bbca 100644 (file)
@@ -55,7 +55,7 @@ public class GetSoneStatusPage extends JsonPage {
                String soneId = request.getHttpRequest().getParam("sone");
                Sone sone = core.getSone(soneId);
                SoneStatus soneStatus = core.getSoneStatus(sone);
-               return new JsonObject().put("status", soneStatus.name()).put("modified", sone.getModificationCounter() > 0).put("lastUpdated", new SimpleDateFormat("MMM d, yyyy, HH:mm:ss").format(new Date(sone.getTime())));
+               return new JsonObject().put("status", soneStatus.name()).put("modified", sone.getModificationCounter() > 0).put("lastUpdated", new SimpleDateFormat("MMM d, yyyy, HH:mm:ss").format(new Date(sone.getTime()))).put("age", (System.currentTimeMillis() - sone.getTime()) / 1000);
        }
 
 }