I want to know the uptime since the last wake from standby.

The command uptime only shows the difference between current time minus the last startup time.

link|improve this question
feedback

2 Answers

What are you using to initiate the standby?

If you can use a script, then after the line

echo -n "standby" > /proc/acpi/sleep

you could have the line

echo `date +%s` >> /var/log/wakeups.log

Or something similar. This would mean that the first thing the machine did when it woke up was to write the current time and date to a log file (n seconds since epoch).

Then tail -1 /var/log/wakeups.log would give you the last time. You could could subtract this from the current time to get seconds since the last wakeup.

link|improve this answer
feedback

Search for the last occurence of the string "PM: restore of devices complete" in /var/log/messages. If your machine has been up too long, then the log may be rotated, though.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.