Skip to content

Commit

Permalink
Improve duration to human readable display nzymedefense#827
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartkoopmann committed Aug 21, 2023
1 parent 0ab8907 commit 02a167f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/app/nzyme/core/util/Tools.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public static boolean isValidMacAddress(String addr) {
}

public static String durationToHumanReadable(Duration duration) {
if (duration.getStandardSeconds() == 0) {
return "n/a";
}

if (duration.getStandardSeconds() < 60) {
return duration.getStandardSeconds() + " seconds";
}

if (duration.getStandardHours() < 2) {
return duration.getStandardMinutes() + " minutes";
}
Expand Down

0 comments on commit 02a167f

Please sign in to comment.