Copilot commented on code in PR #11670:
URL: https://github.com/apache/cloudstack/pull/11670#discussion_r2357999501
##########
server/src/main/java/com/cloud/server/StatsCollector.java:
##########
@@ -937,12 +937,12 @@ private void getProcFileSystemData(@NotNull
ManagementServerHostStatsEntry newEn
logger.info(String.format("used memory from /proc: %d",
newEntry.getSystemMemoryUsed()));
}
try {
- String bootTime = Script.runSimpleBashScript("uptime -s");
+ String bootTime = Script.runSimpleBashScript("date -d @$(grep
btime /proc/stat | awk '{print $2}') '+%Y-%m-%d %H:%M:%S'");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd
hh:mm:ss", Locale.ENGLISH);
Review Comment:
The SimpleDateFormat pattern uses lowercase 'hh' for hours, which represents
12-hour format. Since the date command outputs 24-hour format, this should be
'HH' for 24-hour format to correctly parse the boot time.
```suggestion
SimpleDateFormat formatter = new
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]