|
|
|
@ -21,6 +21,11 @@ public class TimeFormatter { |
|
|
|
|
private static final Logger log = |
|
|
|
|
LoggerFactory.getLogger(TimeFormatter.class); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Format time to day, hours, minutes, secs. |
|
|
|
|
* @param ltime interval in milliseconds |
|
|
|
|
* @return Formatted time string. |
|
|
|
|
*/ |
|
|
|
|
public static String formatTime(Long ltime) { |
|
|
|
|
if (ltime == null) { |
|
|
|
|
return ""; |
|
|
|
@ -49,15 +54,16 @@ public class TimeFormatter { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ss > 0) { |
|
|
|
|
sb.append(dd).append("sec. "); |
|
|
|
|
sb.append(ss).append("sec. "); |
|
|
|
|
} |
|
|
|
|
return sb.toString().trim(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// private enum MunchUnit {
|
|
|
|
|
// mu_NONE, mu_DAY, mu_HOUR, mu_MINUTE, mw_SECOND
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Regex-heavy digester of time values (optional) and units. |
|
|
|
|
* @author timh |
|
|
|
|
* @since Jan 10, 2022 |
|
|
|
|
*/ |
|
|
|
|
private static class TimeMuncher { |
|
|
|
|
|
|
|
|
|
public class MunchException extends Exception { |
|
|
|
|