summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--misc-utils/logger.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 3d77307fb..fce7e0e78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,7 @@ AC_CHECK_HEADERS([ \
sys/swap.h \
sys/syscall.h \
sys/time.h \
+ sys/timex.h \
sys/ttydefaults.h \
sys/types.h \
sys/un.h \
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 35caf9d9d..03031dac9 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -44,7 +44,6 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
-#include <sys/timex.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -67,6 +66,10 @@
# include <systemd/sd-journal.h>
#endif
+#ifdef HAVE_SYS_TIMEX_H
+# include <sys/timex.h>
+#endif
+
enum {
TYPE_UDP = (1 << 1),
TYPE_TCP = (1 << 2),
@@ -325,7 +328,9 @@ static void syslog_rfc5424(const struct logger_ctl *ctl, const char *msg)
{
char *buf, *tag = NULL, *hostname = NULL;
char pid[32], time[64], timeq[80];
+#ifdef HAVE_SYS_TIMEX_H
struct ntptimeval ntptv;
+#endif
struct timeval tv;
struct tm *tm;
int len;
@@ -364,11 +369,13 @@ static void syslog_rfc5424(const struct logger_ctl *ctl, const char *msg)
snprintf(pid, sizeof(pid), " %d", ctl->pid);
if (ctl->rfc5424_tq) {
+#ifdef HAVE_SYS_TIMEX_H
if (ntp_gettime(&ntptv) == TIME_OK)
snprintf(timeq, sizeof(timeq),
" [timeQuality tzKnown=\"1\" isSynced=\"1\" syncAccuracy=\"%ld\"]",
ntptv.maxerror);
else
+#endif
snprintf(timeq, sizeof(timeq),
" [timeQuality tzKnown=\"1\" isSynced=\"0\"]");
}