diff options
author | roberto <roberto@FreeBSD.org> | 2008-08-17 17:37:33 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 2008-08-17 17:37:33 +0000 |
commit | 4ded1c1fa0bc21c61f91a2dbe864835986745121 (patch) | |
tree | 16d100fbc9dae63888d48b464e471ba0e5065193 /contrib/ntp/libntp/buftvtots.c | |
parent | 8b5a86d4fda08a9c68231415812edcb26be52f79 (diff) | |
download | FreeBSD-src-4ded1c1fa0bc21c61f91a2dbe864835986745121.zip FreeBSD-src-4ded1c1fa0bc21c61f91a2dbe864835986745121.tar.gz |
Flatten the dist and various 4.n.n trees in preparation of future ntp imports.
Diffstat (limited to 'contrib/ntp/libntp/buftvtots.c')
-rw-r--r-- | contrib/ntp/libntp/buftvtots.c | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/contrib/ntp/libntp/buftvtots.c b/contrib/ntp/libntp/buftvtots.c deleted file mode 100644 index 1944233..0000000 --- a/contrib/ntp/libntp/buftvtots.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * buftvtots - pull a Unix-format (struct timeval) time stamp out of - * an octet stream and convert it to a l_fp time stamp. - * This is useful when using the clock line discipline. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "ntp_fp.h" -#include "ntp_unixtime.h" - -int -buftvtots( - const char *bufp, - l_fp *ts - ) -{ - register const u_char *bp; - register u_long sec; - register u_long usec; - struct timeval tv; - -#ifdef WORDS_BIGENDIAN - bp = (const u_char *)bufp; - - sec = (u_long)*bp++ & 0xff; - sec <<= 8; - sec += (u_long)*bp++ & 0xff; - sec <<= 8; - sec += (u_long)*bp++ & 0xff; - sec <<= 8; - sec += (u_long)*bp++ & 0xff; - - if (sizeof(tv.tv_sec) == 8) { - sec += (u_long)*bp++ & 0xff; - sec <<= 8; - sec += (u_long)*bp++ & 0xff; - sec <<= 8; - sec += (u_long)*bp++ & 0xff; - sec <<= 8; - sec += (u_long)*bp++ & 0xff; - } - - usec = (u_long)*bp++ & 0xff; - usec <<= 8; - usec += (u_long)*bp++ & 0xff; - usec <<= 8; - usec += (u_long)*bp++ & 0xff; - usec <<= 8; - usec += (u_long)*bp++ & 0xff; - - if (sizeof(tv.tv_usec) == 8) { - usec += (u_long)*bp++ & 0xff; - usec <<= 8; - usec += (u_long)*bp++ & 0xff; - usec <<= 8; - usec += (u_long)*bp++ & 0xff; - usec <<= 8; - usec += (u_long)*bp & 0xff; - } -#else - bp = (const u_char *)bufp + 7; - - usec = (u_long)*bp-- & 0xff; - usec <<= 8; - usec += (u_long)*bp-- & 0xff; - usec <<= 8; - usec += (u_long)*bp-- & 0xff; - usec <<= 8; - usec += (u_long)*bp-- & 0xff; - - if (sizeof(tv.tv_usec) == 8) { - usec += (u_long)*bp-- & 0xff; - usec <<= 8; - usec += (u_long)*bp-- & 0xff; - usec <<= 8; - usec += (u_long)*bp-- & 0xff; - usec <<= 8; - usec += (u_long)*bp-- & 0xff; - } - - sec = (u_long)*bp-- & 0xff; - sec <<= 8; - sec += (u_long)*bp-- & 0xff; - sec <<= 8; - sec += (u_long)*bp-- & 0xff; - sec <<= 8; - sec += (u_long)*bp-- & 0xff; - - if (sizeof (tv.tv_sec) == 8) { - sec += (u_long)*bp-- & 0xff; - sec <<= 8; - sec += (u_long)*bp-- & 0xff; - sec <<= 8; - sec += (u_long)*bp-- & 0xff; - sec <<= 8; - sec += (u_long)*bp & 0xff; - } -#endif - ts->l_ui = sec + (u_long)JAN_1970; - if (usec > 999999) - return 0; - TVUTOTSF(usec, ts->l_uf); - return 1; -} |