diff options
author | Cy Schubert <cy@FreeBSD.org> | 2024-05-10 15:15:56 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2024-05-26 22:55:52 +0000 |
commit | 1f833b3fc9968c3dd7ed79ccf0525ebf16c891ad (patch) | |
tree | 85801af20e3b694584668aeb39ecec75ee71f72c /libntp/timexsup.c | |
parent | ab1f1aa8333369a83ff284848fc3fc2e52d5f29f (diff) |
Diffstat (limited to 'libntp/timexsup.c')
-rw-r--r-- | libntp/timexsup.c | 22 |
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); |