| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ntp_io.c,v 1.1.1.1 2009/12/13 16:56:13 kardel Exp $ */ | | 1 | /* $NetBSD: ntp_io.c,v 1.2 2009/12/14 00:43:58 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * ntp_io.c - input/output routines for ntpd. The socket-opening code | | 4 | * ntp_io.c - input/output routines for ntpd. The socket-opening code |
5 | * was shamelessly stolen from ntpd. | | 5 | * was shamelessly stolen from ntpd. |
6 | */ | | 6 | */ |
7 | | | 7 | |
8 | #ifdef HAVE_CONFIG_H | | 8 | #ifdef HAVE_CONFIG_H |
9 | # include <config.h> | | 9 | # include <config.h> |
10 | #endif | | 10 | #endif |
11 | | | 11 | |
12 | #include <stdio.h> | | 12 | #include <stdio.h> |
13 | #include <signal.h> | | 13 | #include <signal.h> |
14 | #ifdef HAVE_SYS_PARAM_H | | 14 | #ifdef HAVE_SYS_PARAM_H |
| @@ -3070,28 +3070,28 @@ fetch_timestamp( | | | @@ -3070,28 +3070,28 @@ fetch_timestamp( |
3070 | struct cmsghdr *cmsghdr; | | 3070 | struct cmsghdr *cmsghdr; |
3071 | | | 3071 | |
3072 | cmsghdr = CMSG_FIRSTHDR(msghdr); | | 3072 | cmsghdr = CMSG_FIRSTHDR(msghdr); |
3073 | while (cmsghdr != NULL) { | | 3073 | while (cmsghdr != NULL) { |
3074 | switch (cmsghdr->cmsg_type) | | 3074 | switch (cmsghdr->cmsg_type) |
3075 | { | | 3075 | { |
3076 | case SCM_TIMESTAMP: | | 3076 | case SCM_TIMESTAMP: |
3077 | { | | 3077 | { |
3078 | struct timeval *tvp; | | 3078 | struct timeval *tvp; |
3079 | double dtemp; | | 3079 | double dtemp; |
3080 | l_fp nts; | | 3080 | l_fp nts; |
3081 | | | 3081 | |
3082 | tvp = (struct timeval *)CMSG_DATA(cmsghdr); | | 3082 | tvp = (struct timeval *)CMSG_DATA(cmsghdr); |
3083 | DPRINTF(4, ("fetch_timestamp: system network time stamp: %ld.%06ld\n", | | 3083 | DPRINTF(4, ("fetch_timestamp: system network time stamp: %lld.%06ld\n", |
3084 | tvp->tv_sec, tvp->tv_usec)); | | 3084 | (long long)tvp->tv_sec, tvp->tv_usec)); |
3085 | nts.l_i = tvp->tv_sec + JAN_1970; | | 3085 | nts.l_i = tvp->tv_sec + JAN_1970; |
3086 | dtemp = (tvp->tv_usec | | 3086 | dtemp = (tvp->tv_usec |
3087 | + (ntp_random() * 2. / FRAC)) / 1e6; | | 3087 | + (ntp_random() * 2. / FRAC)) / 1e6; |
3088 | nts.l_uf = (u_int32)(dtemp * FRAC); | | 3088 | nts.l_uf = (u_int32)(dtemp * FRAC); |
3089 | #ifdef DEBUG_TIMING | | 3089 | #ifdef DEBUG_TIMING |
3090 | { | | 3090 | { |
3091 | l_fp dts; | | 3091 | l_fp dts; |
3092 | | | 3092 | |
3093 | dts = ts; | | 3093 | dts = ts; |
3094 | L_SUB(&dts, &nts); | | 3094 | L_SUB(&dts, &nts); |
3095 | collect_timing(rb, | | 3095 | collect_timing(rb, |
3096 | "input processing delay", | | 3096 | "input processing delay", |
3097 | 1, &dts); | | 3097 | 1, &dts); |