aboutsummaryrefslogtreecommitdiff
path: root/libntp/timexsup.c
diff options
context:
space:
mode:
Diffstat (limited to 'libntp/timexsup.c')
-rw-r--r--libntp/timexsup.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/libntp/timexsup.c b/libntp/timexsup.c
index 979a7c4aea8e..21f7738d3e5f 100644
--- a/libntp/timexsup.c
+++ b/libntp/timexsup.c
@@ -6,14 +6,27 @@
*/
#include "config.h"
-#include "timexsup.h"
#include <limits.h>
#include <math.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#else
+# ifdef HAVE_TIME_H
+# include <time.h>
+# endif
+#endif
#ifdef HAVE_SYS_TIMEX_H
# include <sys/timex.h>
+#else
+# ifdef HAVE_TIMEX_H
+# include <timex.h>
+# endif
#endif
+#include "ntp_types.h"
+#include "timexsup.h"
+
#if defined(MOD_NANO) != defined(STA_NANO)
# warning inconsistent definitions of MOD_NANO vs STA_NANO
#endif
@@ -41,10 +54,11 @@ dbl_from_var_long(
)
{
#ifdef STA_NANO
- if (status & STA_NANO)
+ if (STA_NANO & status) {
return (double)lval * 1e-9;
+ }
#else
- (void)status;
+ UNUSED_ARG(status);
#endif
return (double)lval * 1e-6;
}
@@ -67,7 +81,7 @@ var_long_from_dbl(
*modes |= MOD_NANO;
dval *= 1e+9;
#else
- (void)modes;
+ UNUSED_ARG(modes);
dval *= 1e+6;
#endif
return clamp_rounded(dval);