[ agent ] [ status ] - accomplish agent status - 5

This commit is contained in:
zeaslity
2023-01-05 15:38:12 +08:00
parent ff66acb950
commit cd712ecb2d
2 changed files with 9 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ public class AgentSystemInfo {
ZoneId.of("UTC+8")
)
))
.upTime(TimeUtils.toRelative(os.getSystemUptime()*1000))
.upTime(TimeUtils.toRelative(os.getSystemUptime()*1000, 3))
.build();
}

View File

@@ -35,6 +35,14 @@ public class TimeUtils {
}
/**
* https://memorynotfound.com/calculate-relative-time-time-ago-java/
*
* calculate relative time from now on
* like 5 days, 3 hours, 16 minutes level 3
*
* */
private static final Map<String, Long> times = new HashMap<>(16);
static {