Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
12 struct timespec uptime
;
14 if (clock_gettime(CLOCK_BOOTTIME
, &uptime
) < 0) {
15 warn("clock_gettime 'CLOCK_BOOTTIME'");
19 h
= uptime
.tv_sec
/ 3600;
20 m
= uptime
.tv_sec
% 3600 / 60;
22 return bprintf("%" PRIuMAX
"h %" PRIuMAX
"m", h
, m
);