aboutsummaryrefslogtreecommitdiffstats
path: root/ntpd/refclock_palisade.c
diff options
context:
space:
mode:
Diffstat (limited to 'ntpd/refclock_palisade.c')
-rw-r--r--ntpd/refclock_palisade.c48
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;
}