- sysinfo(&info);
- uptime = info.uptime;
-#elif __OpenBSD__
- int mib[2];
- size_t size;
- time_t now;
- struct timeval boottime;
-
- time(&now);
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_BOOTTIME;
-
- size = sizeof(boottime);
-
- if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1)
- uptime = now - boottime.tv_sec;
- else
+ if (clock_gettime(CLOCK_BOOTTIME, &uptime) < 0) {
+ warn("clock_gettime 'CLOCK_BOOTTIME'");