I would like to save the output of the uptime command into a csv file in a Bash script. Since the uptime command has different output formats based on the time since the last reboot I came up with a pretty heavy solution based on case, but there is surely a more elegant way of doing this.
I put my laptop to suspend mode, woke it up later, and now it shows uptime some 23 hours (with uptime), which is obviously not true. I suspect uptime simply returns the difference between the timestamp at boot and now.
Is there a way to show uptime excluding time spent in low power modes like suspend and hibernate?
I am working in an embedded device using a debian based distribution.
I'm monitoring the CPU load average using uptime command and atop.
Sometimes I see the uptime 1min average going up a lot (up to 4 in a single processor board, A LOT!) but in atop (with interval 1) I don't see the huge CPU usage that the uptime command suggest (I see something like: CPU sys 7% user 4% irq 1% idle 88%)