How can I reset uptime without rebooting? Re: suspend2 issue
This seems like a simple thing but I'm not sure anyone has tried to do this before. Simply I want to reset my uptime counter back to zero without rebooting.
Why would I want to? I've been using the suspend2 patches to hibernate my laptop, then resume the system at a later point. It resumes the kernel back to its original state, including uptime, so it now misreports how long the machine has been on (its value is now cumulative). I use uptime meaningfully in various scripts to measure battery life and such.
I've tried "echo '0 0' > /proc/uptime", but that is a read-only file. I've looked at the sysinfo() function, but it is readonly; there doesn't appear to be a setsysinfo() function. Lastly I could replace uptime with some script to calculate the real uptime relative to when the resume occurred, but that seems kludgy.
Thanks for any help.
My system is Gentoo, kernel 2.6.16 (suspend2-sources).