diff options
author | Karel Zak <kzak@redhat.com> | 2015-03-10 11:37:45 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2015-03-12 10:21:38 +0100 |
commit | 14e6f4a5397de4b688315f6177d9f0ac8c8af774 (patch) | |
tree | fadcb23e2554aa58661c3978389289a272729b60 | |
parent | 82f658c68ca6cb67bdf7bf195b96f9664e0a3a78 (diff) | |
download | util-linux-14e6f4a5397de4b688315f6177d9f0ac8c8af774.tar.gz |
logger: check for ntp_gettime() rather than for timex.h
It seems that musl libc and uClibc without UCLIBC_NTP_LEGACY
does not provide ntp_gettime and compile will fail.
References: https://github.com/karelzak/util-linux/issues/174
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | misc-utils/logger.c | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 122b5d532..421aedc9b 100644 --- a/configure.ac +++ b/configure.ac @@ -343,6 +343,7 @@ AC_CHECK_FUNCS([ \ lseek64 \ mempcpy \ nanosleep \ + ntp_gettime \ open_memstream \ personality \ posix_fadvise \ diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 0a9e4ab57..2fd3ddf1d 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -366,9 +366,6 @@ static void syslog_rfc5424_header(struct logger_ctl *const ctl) { char *hostname = NULL; char pid[32], time[64], timeq[80]; -#ifdef HAVE_SYS_TIMEX_H - struct ntptimeval ntptv; -#endif struct timeval tv; struct tm *tm; @@ -408,7 +405,9 @@ static void syslog_rfc5424_header(struct logger_ctl *const ctl) snprintf(pid, sizeof(pid), " %d", ctl->pid); if (ctl->rfc5424_tq) { -#ifdef HAVE_SYS_TIMEX_H +#ifdef HAVE_NTP_GETTIME + struct ntptimeval ntptv; + if (ntp_gettime(&ntptv) == TIME_OK) snprintf(timeq, sizeof(timeq), " [timeQuality tzKnown=\"1\" isSynced=\"1\" syncAccuracy=\"%ld\"]", |