diff options
author | Karel Zak | 2014-05-06 13:16:05 +0200 |
---|---|---|
committer | Karel Zak | 2014-05-06 13:16:05 +0200 |
commit | 08ca3e26a8feb0353a960b6b6d20ccb2755db8af (patch) | |
tree | 68dd836cdb30cf752643f047b4f6548a4065d409 /lib | |
parent | hwclock: fix typo (diff) | |
download | kernel-qcow2-util-linux-08ca3e26a8feb0353a960b6b6d20ccb2755db8af.tar.gz kernel-qcow2-util-linux-08ca3e26a8feb0353a960b6b6d20ccb2755db8af.tar.xz kernel-qcow2-util-linux-08ca3e26a8feb0353a960b6b6d20ccb2755db8af.zip |
lib/timeutils: remove get_boot_time from libcommon
clock_gettime() needs -lrt, so let's keep this stuff
outside libcommon.la
Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/timeutils.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/lib/timeutils.c b/lib/timeutils.c index d542c2f27..b811041e4 100644 --- a/lib/timeutils.c +++ b/lib/timeutils.c @@ -340,29 +340,3 @@ int parse_timestamp(const char *t, usec_t *usec) return 0; } - -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; -} |