c++ - Get date/time of last reboot programmatically -
i find time of last reboot programmatically in linux. using c , c++ in module.
is there api?
there's no direct api, can read /proc/uptime
"file" learn how many seconds system have been running, subtract current time - , assume that's when machine rebooted.
/proc/uptime file contains 2 numbers: uptime of system (seconds), , amount of time spent in idle process (seconds).
Comments
Post a Comment