2 * timexsup.c - 'struct timex' support functions
4 * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project.
5 * The contents of 'html/copyright.html' apply.
13 #ifdef HAVE_SYS_TIMEX_H
14 # include <sys/timex.h>
17 #if defined(MOD_NANO) != defined(STA_NANO)
18 # warning inconsistent definitions of MOD_NANO vs STA_NANO
27 dval = floor(dval + 0.5);
29 /* clamp / saturate */
44 if (status & STA_NANO)
45 return (double)lval * 1e-9;
49 return (double)lval * 1e-6;
57 return (double)lval * 1e-6;
73 return clamp_rounded(dval);
81 return clamp_rounded(dval * 1e+6);