summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd/refclock_hopfser.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/ntpd/refclock_hopfser.c')
-rw-r--r--contrib/ntp/ntpd/refclock_hopfser.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/contrib/ntp/ntpd/refclock_hopfser.c b/contrib/ntp/ntpd/refclock_hopfser.c
index a9d74dd..1d27333 100644
--- a/contrib/ntp/ntpd/refclock_hopfser.c
+++ b/contrib/ntp/ntpd/refclock_hopfser.c
@@ -14,6 +14,11 @@
# include "config.h"
#endif
+#if defined(SYS_WINNT)
+#undef close
+#define close closesocket
+#endif
+
#if defined(REFCLOCK) && (defined(CLOCK_HOPF_SERIAL))
#include "ntpd.h"
@@ -216,7 +221,7 @@ hopfserial_receive (
struct refclockproc *pp;
struct peer *peer;
- int sync; /* synchronization indicator */
+ int synch; /* synchhronization indicator */
int DoW; /* Dow */
int day, month; /* ddd conversion */
@@ -234,7 +239,7 @@ hopfserial_receive (
up->rpt_next = 0; /* wait until next poll interval occur */
- pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &pp->lastrec);
+ pp->lencode = (u_short)refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &pp->lastrec);
if (pp->lencode == 0)
return;
@@ -245,7 +250,7 @@ hopfserial_receive (
#else
"%*c%1x%1x%2d%2d%2d%2d%2d%2d", /* stx...cr,lf,etx */
#endif
- &sync,
+ &synch,
&DoW,
&pp->hour,
&pp->minute,
@@ -286,7 +291,7 @@ hopfserial_receive (
#if 0
wsprintf(pp->a_lastcode,
"STATUS: %1X%1X, DATE: %02d.%02d.%04d TIME: %02d:%02d:%02d",
- sync,
+ synch,
DoW,
day,
month,
@@ -296,7 +301,7 @@ hopfserial_receive (
pp->second);
pp->lencode = strlen(pp->a_lastcode);
- if ((sync && 0xc) == 0 ){ /* time ok? */
+ if ((synch && 0xc) == 0 ){ /* time ok? */
refclock_report(peer, CEVNT_BADTIME);
pp->leap = LEAP_NOTINSYNC;
return;
@@ -305,7 +310,7 @@ hopfserial_receive (
/*
* If clock has no valid status then report error and exit
*/
- if ((sync & HOPF_OPMODE) == HOPF_INVALID ){ /* time ok? */
+ if ((synch & HOPF_OPMODE) == HOPF_INVALID ){ /* time ok? */
refclock_report(peer, CEVNT_BADTIME);
pp->leap = LEAP_NOTINSYNC;
return;
@@ -316,7 +321,7 @@ hopfserial_receive (
* if CLK_FLAG1 is set, sychronize even if no radio operation
*/
- if ((sync & HOPF_OPMODE) == HOPF_INTERNAL){
+ if ((synch & HOPF_OPMODE) == HOPF_INTERNAL){
if ((pp->sloppyclockflag & CLK_FLAG1) == 0) {
refclock_report(peer, CEVNT_BADTIME);
pp->leap = LEAP_NOTINSYNC;
@@ -329,10 +334,11 @@ hopfserial_receive (
refclock_report(peer, CEVNT_BADTIME);
return;
}
+ pp->lastref = pp->lastrec;
refclock_receive(peer);
#if 0
- msyslog(LOG_ERR, " D:%x D:%d D:%d",sync,pp->minute,pp->second);
+ msyslog(LOG_ERR, " D:%x D:%d D:%d",synch,pp->minute,pp->second);
#endif
record_clock_stats(&peer->srcadr, pp->a_lastcode);
OpenPOWER on IntegriCloud