summaryrefslogtreecommitdiffstats
path: root/sys-utils/dmesg.c
diff options
context:
space:
mode:
authorSami Kerola2014-04-23 23:59:29 +0200
committerSami Kerola2014-05-04 12:42:03 +0200
commit929f939e6aa49952881d44706e4249ca7d644578 (patch)
tree0d7b7b9d6a897a941eb949d8eaf21efb91084ad7 /sys-utils/dmesg.c
parentuuidd: remove timeout from systemd service file (diff)
downloadkernel-qcow2-util-linux-929f939e6aa49952881d44706e4249ca7d644578.tar.gz
kernel-qcow2-util-linux-929f939e6aa49952881d44706e4249ca7d644578.tar.xz
kernel-qcow2-util-linux-929f939e6aa49952881d44706e4249ca7d644578.zip
dmesg: move get_boot_time() to lib/timeutils
In future the last(1) will use get_boot_time() as well. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/dmesg.c')
-rw-r--r--sys-utils/dmesg.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index df68c8440..196cc61ea 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -472,33 +472,6 @@ static int get_syslog_buffer_size(void)
return n > 0 ? n : 0;
}
-static int get_boot_time(struct timeval *boot_time)
-{
- struct timespec hires_uptime;
- struct timeval lores_uptime, now;
- struct sysinfo info;
-
- if (gettimeofday(&now, NULL) != 0) {
- warn(_("gettimeofday failed"));
- return -errno;
- }
-
-#ifdef CLOCK_BOOTTIME
- if (clock_gettime(CLOCK_BOOTTIME, &hires_uptime) == 0) {
- TIMESPEC_TO_TIMEVAL(&lores_uptime, &hires_uptime);
- timersub(&now, &lores_uptime, boot_time);
- return 0;
- }
-#endif
- /* fallback */
- if (sysinfo(&info) != 0)
- warn(_("sysinfo failed"));
-
- boot_time->tv_sec = now.tv_sec - info.uptime;
- boot_time->tv_usec = 0;
- return 0;
-}
-
/*
* Reads messages from regular file by mmap
*/