Deleted Added
full compact
25c25
< * $FreeBSD: head/contrib/tcpdump/print-ntp.c 111729 2003-03-02 08:25:48Z fenner $
---
> * $FreeBSD: head/contrib/tcpdump/print-ntp.c 127675 2004-03-31 14:57:24Z bms $
29,30c29,30
< static const char rcsid[] =
< "@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.32.4.1 2002/07/10 07:13:37 guy Exp $ (LBL)";
---
> static const char rcsid[] _U_ =
> "@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.37.2.2 2003/11/16 08:51:36 guy Exp $ (LBL)";
37,39c37
< #include <sys/param.h>
< #include <sys/time.h>
< #include <sys/socket.h>
---
> #include <tcpdump-stdinc.h>
41,43d38
< #include <netinet/in.h>
<
< #include <ctype.h>
45a41,43
> #ifdef HAVE_STRFTIME
> #include <time.h>
> #endif
48a47
> #include "extract.h"
75c74
< printf(" v%d", version);
---
> printf("NTPv%d", version);
130c129
< printf(" strat %d", bp->stratum);
---
> printf(", strat %d", bp->stratum);
133c132
< printf(" poll %d", bp->ppoll);
---
> printf(", poll %d", bp->ppoll);
137c136
< printf(" prec %d", bp->precision);
---
> printf(", prec %d", bp->precision);
147c146
< fputs(" disp ", stdout);
---
> fputs(", disp ", stdout);
151c150
< fputs(" ref ", stdout);
---
> fputs(", ref ", stdout);
207,208c206,207
< i = ntohs(sfp->int_part);
< f = ntohs(sfp->fraction);
---
> i = EXTRACT_16BITS(&sfp->int_part);
> f = EXTRACT_16BITS(&sfp->fraction);
224,225c223,224
< i = ntohl(lfp->int_part);
< uf = ntohl(lfp->fraction);
---
> i = EXTRACT_32BITS(&lfp->int_part);
> uf = EXTRACT_32BITS(&lfp->fraction);
231a231,245
>
> #ifdef HAVE_STRFTIME
> /*
> * For extra verbosity, print the time in human-readable format.
> */
> if (vflag > 1 && i) {
> time_t seconds = i - JAN_1970;
> struct tm *tm;
> char time_buf[128];
>
> tm = localtime(&seconds);
> strftime(time_buf, sizeof (time_buf), "%Y/%m/%d %H:%M:%S", tm);
> printf (" (%s)", time_buf);
> }
> #endif
240,241c254,255
< register u_int32_t uf;
< register u_int32_t ouf;
---
> register u_int32_t u, uf;
> register u_int32_t ou, ouf;
246c260,267
< i = ntohl(lfp->int_part) - ntohl(olfp->int_part);
---
> u = EXTRACT_32BITS(&lfp->int_part);
> ou = EXTRACT_32BITS(&olfp->int_part);
> uf = EXTRACT_32BITS(&lfp->fraction);
> ouf = EXTRACT_32BITS(&olfp->fraction);
> if (ou == 0 && ouf == 0) {
> p_ntp_time(lfp);
> return;
> }
248,249c269
< uf = ntohl(lfp->fraction);
< ouf = ntohl(olfp->fraction);
---
> i = u - ou;
282a303
>