diff options
author | Cy Schubert <cy@FreeBSD.org> | 2020-06-24 00:20:45 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2020-06-24 00:20:45 +0000 |
commit | 3914721463f70500ecc1f59312b122d8788465cf (patch) | |
tree | f253e72838d762e229ca71912a4a928e96cac2bd /ntpd/refclock_palisade.c | |
parent | 5171bc9b11192d9ad273db7854787eaa65eb9997 (diff) |
Notes
Diffstat (limited to 'ntpd/refclock_palisade.c')
-rw-r--r-- | ntpd/refclock_palisade.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/ntpd/refclock_palisade.c b/ntpd/refclock_palisade.c index e698d72cc521..cb68255d05b0 100644 --- a/ntpd/refclock_palisade.c +++ b/ntpd/refclock_palisade.c @@ -304,13 +304,13 @@ palisade_start ( int fd; char gpsdev[20]; struct termios tio; + u_int speed; snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit); /* * Open serial port. */ - u_int speed; speed = (CLK_TYPE(peer) == CLK_COPERNICUS) ? SPEED232COP : SPEED232; fd = refclock_open(gpsdev, speed, LDISC_RAW); if (fd <= 0) { @@ -941,30 +941,32 @@ TSIP_decode ( return 0; } /* Get date & time from WN & ToW minus offset */ - TCivilDate cd; - TGpsDatum wd; - l_fp ugo; /* UTC-GPS offset, negative number */ - ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset; - ugo.l_uf = 0; - wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo); - gpscal_to_calendar(&cd, &wd); - pp->year = cd.year; - pp->day = cd.yearday; - pp->hour = cd.hour; - pp->minute = cd.minute; - pp->second = cd.second; - pp->nsec = 0; - pp->leap = LEAP_NOWARNING; + { + TCivilDate cd; + TGpsDatum wd; + l_fp ugo; /* UTC-GPS offset, negative number */ + ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset; + ugo.l_uf = 0; + wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo); + gpscal_to_calendar(&cd, &wd); + pp->year = cd.year; + pp->day = cd.yearday; + pp->hour = cd.hour; + pp->minute = cd.minute; + pp->second = cd.second; + pp->nsec = 0; + pp->leap = LEAP_NOWARNING; #ifdef DEBUG - if (debug > 1) { - printf("GPS TOW: %ld\n", tow); - printf("GPS WN: %d\n", wn); - printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset); - printf("TSIP_decode: unit %d: %02X #%d %02d:%02d:%02d.%09ld %02d/%02d/%04d ", - up->unit, mb(0) & 0xff, event, pp->hour, pp->minute, pp->second, - pp->nsec, cd.month, cd.monthday, pp->year); - } + if (debug > 1) { + printf("GPS TOW: %ld\n", tow); + printf("GPS WN: %d\n", wn); + printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset); + printf("TSIP_decode: unit %d: %02X #%d %02d:%02d:%02d.%09ld %02d/%02d/%04d ", + up->unit, mb(0) & 0xff, event, pp->hour, pp->minute, pp->second, + pp->nsec, cd.month, cd.monthday, pp->year); + } #endif + } return 1; } |