include/at.h \
include/bitops.h \
include/blkdev.h \
- include/boottime.h \
+ include/monotonic.h \
include/c.h \
include/canonicalize.h \
include/carefulputc.h \
*/
extern int get_boot_time(struct timeval *boot_time);
+extern int gettime_monotonic(struct timeval *tv);
+
#endif /* UTIL_LINUX_BOOTTIME_H */
int parse_timestamp(const char *t, usec_t *usec);
-int gettime_monotonic(struct timeval *tv);
-
#endif /* UTIL_LINUX_TIME_UTIL_H */
-
+/*
+ * Please, don't add this file to libcommon because clock_gettime() requires
+ * -lrt on systems with old libc.
+ */
#include <time.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include "c.h"
#include "nls.h"
-#include "boottime.h"
+#include "monotonic.h"
int get_boot_time(struct timeval *boot_time)
{
return -ENOSYS;
#endif
}
+
+int gettime_monotonic(struct timeval *tv)
+{
+#ifdef CLOCK_MONOTONIC
+ /* Can slew only by ntp and adjtime */
+ int ret;
+ struct timespec ts;
+
+# ifdef CLOCK_MONOTONIC_RAW
+ /* Linux specific, cant slew */
+ if (!(ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts))) {
+# else
+ if (!(ret = clock_gettime(CLOCK_MONOTONIC, &ts))) {
+# endif
+ tv->tv_sec = ts.tv_sec;
+ tv->tv_usec = ts.tv_nsec / 1000;
+ }
+ return ret;
+#else
+ return gettimeofday(tv, NULL);
+#endif
+}
return 0;
}
-
-
-int gettime_monotonic(struct timeval *tv)
-{
-#ifdef CLOCK_MONOTONIC
- /* Can slew only by ntp and adjtime */
- int ret;
- struct timespec ts;
-
-# ifdef CLOCK_MONOTONIC_RAW
- /* Linux specific, cant slew */
- if (!(ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts))) {
-# else
- if (!(ret = clock_gettime(CLOCK_MONOTONIC, &ts))) {
-# endif
- tv->tv_sec = ts.tv_sec;
- tv->tv_usec = ts.tv_nsec / 1000;
- }
- return ret;
-#else
- return gettimeofday(tv, NULL);
-#endif
-}
usrlib_exec_LTLIBRARIES += libmount.la
libmount_la_SOURCES = \
include/list.h \
+ lib/monotonic.c \
\
libmount/src/cache.c \
libmount/src/fs.c \
#include "closestream.h"
#include "pathnames.h"
#include "mountP.h"
-#include "timeutils.h"
+#include "monotonic.h"
/*
* lock handler
dist_man_MANS += \
login-utils/last.1 \
login-utils/lastb.1
-last_SOURCES = login-utils/last.c lib/boottime.c
+last_SOURCES = login-utils/last.c lib/monotonic.c
last_LDADD = $(LDADD) libcommon.la $(CLOCKGETTIME_LIBS)
install-exec-hook-last:
#include "carefulputc.h"
#include "strutils.h"
#include "timeutils.h"
-#include "boottime.h"
+#include "monotonic.h"
#if defined(_HAVE_UT_TV)
# define UL_UT_TIME ut_tv.tv_sec
if BUILD_DMESG
bin_PROGRAMS += dmesg
dist_man_MANS += sys-utils/dmesg.1
-dmesg_SOURCES = sys-utils/dmesg.c lib/boottime.c
+dmesg_SOURCES = sys-utils/dmesg.c lib/monotonic.c
dmesg_LDADD = $(LDADD) libcommon.la $(CLOCKGETTIME_LIBS)
endif
if BUILD_BLKDISCARD
sbin_PROGRAMS += blkdiscard
dist_man_MANS += sys-utils/blkdiscard.8
-blkdiscard_SOURCES = sys-utils/blkdiscard.c
+blkdiscard_SOURCES = sys-utils/blkdiscard.c lib/monotonic.c
blkdiscard_LDADD = $(LDADD) libcommon.la $(CLOCKGETTIME_LIBS)
endif
if BUILD_EJECT
usrbin_exec_PROGRAMS += eject
-eject_SOURCES = sys-utils/eject.c
+eject_SOURCES = sys-utils/eject.c lib/monotonic.c
eject_LDADD = $(LDADD) libmount.la libcommon.la $(CLOCKGETTIME_LIBS)
eject_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
dist_man_MANS += sys-utils/eject.1
#include "closestream.h"
#include "optutils.h"
#include "timeutils.h"
-#include "boottime.h"
+#include "monotonic.h"
#include "mangle.h"
#include "pager.h"
#include "xalloc.h"
#include "pathnames.h"
#include "sysfs.h"
-#include "timeutils.h"
+#include "monotonic.h"
/*
* sg_io_hdr_t driver_status -- see kernel include/scsi/scsi.h