Getting the last system boot time on a Chromebook

1,135 views
Skip to first unread message

isa...@chromium.org

unread,
Dec 21, 2017, 8:54:26 AM12/21/17
to Chromium OS dev
Hi all,

I was wondering what would be a good way of getting the last system boot time. I know of the base::SysInfo::Uptime() function which I can use to calculate the last boot time, but this unfortunately suffers problems when you take suspend into account (if the system has suspended at all since boot, uptime is no longer a reliable measure of the total wall time that's elapsed). I would preferably like to get this information on the Chrome side, but I'm also fine with doing a DBus call to get the data from CrOS over to Chrome.


Thanks,
Ivan

Mike Frysinger

unread,
Jan 4, 2018, 3:40:46 AM1/4/18
to isa...@chromium.org, Chromium OS dev
clock_gettime(CLOCK_BOOTTIME) ?
-mike

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en


Ivan Šandrk

unread,
Jan 4, 2018, 12:00:02 PM1/4/18
to Mike Frysinger, Chromium OS dev
Thanks, just what I needed.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages