示例#1
0
 protected static String formatDurration(long diff) {
   if (diff < 60 * 1000L) {
     // less than 1 minute
     if (diff <= 1) return diff + " millisecond";
     else if (diff < 1000L) return diff + " milliseconds";
     else if (diff < 2000L) return ((double) diff / 1000.0) + " second";
     else return ((double) diff / 1000.0) + " seconds";
   } else {
     return org.apache.commons.lang.time.DurationFormatUtils.formatDurationWords(diff, true, true);
   }
 }
示例#2
0
 // TotalDuration: time that took migration including retries (can be identical to Duration)
 public String getTotalDuration() {
   return DurationFormatUtils.formatDurationWords(
       new Date().getTime() - getParameters().getTotalMigrationTime().getTime(), true, true);
 }
 /**
  * @return the uptime of the server, as a human-readable string : "42 days 7 hours 3 minutes 34
  *     seconds"
  */
 public String getUptime() {
   return uptimeInMillis != null
       ? DurationFormatUtils.formatDurationWords(uptimeInMillis, true, true)
       : null;
 }