Commit 711d4d8f authored by Matt Tucker's avatar Matt Tucker Committed by matt

Add days information to uptime (en locale only).

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@2989 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1d3a95c0
...@@ -92,26 +92,37 @@ ...@@ -92,26 +92,37 @@
if ("en".equals(JiveGlobals.getLocale().getLanguage())) { if ("en".equals(JiveGlobals.getLocale().getLanguage())) {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
long lastStarted = webManager.getXMPPServer().getServerInfo().getLastStarted().getTime(); long lastStarted = webManager.getXMPPServer().getServerInfo().getLastStarted().getTime();
long uptime = (now - lastStarted) / 1000L; long uptime = now - lastStarted;
if (uptime < 60) { if (uptime < JiveConstants.MINUTE) {
uptimeDisplay = "Less than 1 minute"; uptimeDisplay = "Less than 1 minute";
} }
else if (uptime < 60*60) { else if (uptime < JiveConstants.HOUR) {
long mins = uptime / (60); long mins = uptime / JiveConstants.MINUTE;
uptimeDisplay = "Approx " + mins + ((mins==1) ? " minute" : " minutes"); uptimeDisplay = mins + ((mins==1) ? " minute" : " minutes");
} }
else if (uptime < 60*60*24) { else if (uptime < JiveConstants.DAY) {
long days = uptime / (60*60); long hours = uptime / JiveConstants.HOUR;
uptimeDisplay = "Approx " + days + ((days==1) ? " hour" : " hours"); uptime -= hours * JiveConstants.HOUR;
long mins = uptime / JiveConstants.MINUTE;
uptimeDisplay = hours + ((hours==1) ? " hour" : " hours" + ", " +
mins + ((mins==1) ? " minute" : " minutes"));
}
else {
long days = uptime / JiveConstants.DAY;
uptime -= days * JiveConstants.DAY;
long hours = uptime / JiveConstants.HOUR;
uptime -= hours * JiveConstants.HOUR;
long mins = uptime / JiveConstants.MINUTE;
uptimeDisplay = days + ((days==1) ? " day" : " days") + ", " +
hours + ((hours==1) ? " hour" : " hours") + ", " +
mins + ((mins==1) ? " minute" : " minutes");
} }
} }
%> %>
<% if (uptimeDisplay != null) { %> <% if (uptimeDisplay != null) { %>
<%= uptimeDisplay %> -- started <%= uptimeDisplay %> -- started
<% } %> <% } %>
<%= JiveGlobals.formatDateTime(webManager.getXMPPServer().getServerInfo().getLastStarted()) %> <%= JiveGlobals.formatDateTime(webManager.getXMPPServer().getServerInfo().getLastStarted()) %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment