From: Martin Burnicki Date: Fri, 20 Mar 2015 10:36:15 +0000 (+0100) Subject: [Bug 1787] DCF77's formerly "antenna" bit is "call bit" since 2003. X-Git-Tag: NTP_4_3_10~8^2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14cdfbfa06c02927696b83bee984a03197a28477;p=thirdparty%2Fntp.git [Bug 1787] DCF77's formerly "antenna" bit is "call bit" since 2003. bk: 550bf81fgY4d3fWg9u0Gsl2pp0-1Ng --- diff --git a/ChangeLog b/ChangeLog index 7404a0eb6..fb2bde672 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ --- -* Added a comment from Juergen Perlinger in ntp_date.c to make the code clearer. +* [Bug 1787] DCF77's formerly "antenna" bit is "call bit" since 2003. +* Comment from Juergen Perlinger in ntp_calendar.c to make the code clearer. * Use predefined function types for parse driver functions used to set up function pointers. Account for changed prototype of parse_inp_fnc_t functions. @@ -50,7 +51,7 @@ (This should work for all versions of Windows >= W2K) * [Bug 2738] Missing buffer initialization in refclocK_parse.c::parsestate(). * [Bug 2739] Parse driver with PPS enabled occasionally evaluates - PPS timestamp with wrong sign. + PPS timestamp with wrong sign. Removed some German umlauts. * [Bug 2740] Removed some obsolete code from the parse driver. * [Bug 2741] Incorrect buffer check in refclocK_parse.c::parsestatus(). @@ -130,7 +131,7 @@ * [Bug 2678] nmea_control() now checks 'refclock_params()' result. (4.2.7p481) 2014/11/22 Released by Harlan Stenn * [Bug 2314] Only enable PPS if kernel consumer binding succeeds. -* [Bug 2314] Kernel PPS binding EOPNOTSUPP is a failure condition. +* [Bug 2314] Kernel PPS binding EOPNOTSUPP is a failure condition. * Rename pps_enable to hardpps_enable. (4.2.7p480) 2014/11/21 Released by Harlan Stenn * [Bug 2677] PATH_MAX isn't #define'd under Windows. diff --git a/include/parse.h b/include/parse.h index aa0fe4787..ca6855d18 100644 --- a/include/parse.h +++ b/include/parse.h @@ -134,7 +134,7 @@ extern unsigned int splclock (void); /* * optional status information */ -#define PARSEB_ALTERNATE 0x00001000 /* alternate antenna used */ +#define PARSEB_CALLBIT 0x00001000 /* "call bit" used to signalize irregularities in the control facilities */ #define PARSEB_POSITION 0x00002000 /* position available */ #define PARSEB_MESSAGE 0x00004000 /* addtitional message data */ /* @@ -152,7 +152,7 @@ extern unsigned int splclock (void); #define PARSEB_PPS 0x20000000 /* valid PPS sample */ #define PARSE_TCINFO (PARSEB_ANNOUNCE|PARSEB_POWERUP|PARSEB_NOSYNC|PARSEB_DST|\ - PARSEB_UTC|PARSEB_LEAPS|PARSEB_ALTERNATE|PARSEB_S_LEAP|\ + PARSEB_UTC|PARSEB_LEAPS|PARSEB_CALLBIT|PARSEB_S_LEAP|\ PARSEB_S_LOCATION|PARSEB_TIMECODE|PARSEB_MESSAGE) #define PARSE_POWERUP(x) ((x) & PARSEB_POWERUP) @@ -163,7 +163,7 @@ extern unsigned int splclock (void); #define PARSE_UTC(x) ((x) & PARSEB_UTC) #define PARSE_LEAPADD(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPADD)) #define PARSE_LEAPDEL(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPDEL)) -#define PARSE_ALTERNATE(x) ((x) & PARSEB_ALTERNATE) +#define PARSE_CALLBIT(x) ((x) & PARSEB_CALLBIT) #define PARSE_LEAPSECOND(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP_SECOND)) #define PARSE_S_LEAP(x) ((x) & PARSEB_S_LEAP) diff --git a/libparse/clk_meinberg.c b/libparse/clk_meinberg.c index 4f763fdfe..4047be5e7 100644 --- a/libparse/clk_meinberg.c +++ b/libparse/clk_meinberg.c @@ -105,7 +105,8 @@ * = '!' during the hour preceeding an daylight saving time * start/end change * = 'A' LEAP second announcement - * = 'R' alternate antenna + * = 'R' "call bit" used to signalize irregularities in the control facilities, + * usually ' ', until 2003 indicated transmission via alternate antenna * * Meinberg GPS receivers * @@ -132,8 +133,10 @@ * = '!' during the hour preceeding an daylight saving time * start/end change * = 'A' LEAP second announcement - * = 'R' alternate antenna (reminiscent of PZF535) usually ' ' - * = 'L' on 23:59:60 + * = 'R' "call bit" used to signalize irregularities in the control facilities, + * usually ' ', until 2003 indicated transmission via alternate antenna + * (reminiscent of PZF receivers) + * = 'L' on 23:59:60 * * Binary messages have a lead in for a fixed header of SOH */ @@ -410,7 +413,7 @@ cvt_meinberg( clock_time->flags |= PARSEB_LEAPADD; if (f[5] == 'R') - clock_time->flags |= PARSEB_ALTERNATE; + clock_time->flags |= PARSEB_CALLBIT; } return CVT_OK; } diff --git a/libparse/clk_rawdcf.c b/libparse/clk_rawdcf.c index 3c6f9198e..132fbc331 100644 --- a/libparse/clk_rawdcf.c +++ b/libparse/clk_rawdcf.c @@ -75,7 +75,8 @@ * Second Contents * 0 - 10 AM: free, FM: 0 * 11 - 14 free - * 15 R - alternate antenna + * 15 R - "call bit" used to signalize irregularities in the control facilities + * (until 2003 indicated transmission via alternate antenna) * 16 A1 - expect zone change (1 hour before) * 17 - 18 Z1,Z2 - time zone * 0 0 illegal @@ -307,7 +308,7 @@ convert_rawdcf( clock_time->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */ if (ext_bf(buffer, DCF_R, dcfprm->zerobits)) - clock_time->flags |= PARSEB_ALTERNATE; + clock_time->flags |= PARSEB_CALLBIT; parseprintf(DD_RAWDCF,("parse: convert_rawdcf: TIME CODE OK: %d:%d, %d.%d.%d, flags 0x%lx\n", (int)clock_time->hour, (int)clock_time->minute, (int)clock_time->day, (int)clock_time->month,(int) clock_time->year, diff --git a/libparse/clk_schmid.c b/libparse/clk_schmid.c index 41eae2c62..5e303b94c 100644 --- a/libparse/clk_schmid.c +++ b/libparse/clk_schmid.c @@ -82,7 +82,7 @@ extern int printf (const char *, ...); #define WS_TIME 0x01 #define WS_SIGNAL 0x02 -#define WS_ALTERNATE 0x01 +#define WS_CALLBIT 0x01 /* "call bit" used to signalize irregularities in the control facilities */ #define WS_ANNOUNCE 0x02 #define WS_TZ 0x0c #define WS_MET 0x08 @@ -168,9 +168,9 @@ cvt_schmid( if (buffer[7] & WS_SIGNAL) { - if (buffer[8] & WS_ALTERNATE) + if (buffer[8] & WS_CALLBIT) { - clock_time->flags |= PARSEB_ALTERNATE; + clock_time->flags |= PARSEB_CALLBIT; } if (buffer[8] & WS_ANNOUNCE) diff --git a/libparse/parse.c b/libparse/parse.c index 50781796c..9e663f911 100644 --- a/libparse/parse.c +++ b/libparse/parse.c @@ -284,7 +284,7 @@ parse_ioread( break; case PARSE_IO_CS8: - ch &= (char) 0xFF; + ch &= (char) 0xFFU; break; } diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c index 3117332ac..3b0b08281 100644 --- a/ntpd/refclock_parse.c +++ b/ntpd/refclock_parse.c @@ -2525,7 +2525,7 @@ parsestate( { PARSEB_LEAPADD, "LEAP ADD WARNING" }, { PARSEB_LEAPDEL, "LEAP DELETE WARNING" }, { PARSEB_LEAPSECOND, "LEAP SECOND" }, - { PARSEB_ALTERNATE, "ALTERNATE ANTENNA" }, + { PARSEB_CALLBIT, "CALL BIT" }, { PARSEB_TIMECODE, "TIME CODE" }, { PARSEB_PPS, "PPS" }, { PARSEB_POSITION, "POSITION" }, diff --git a/parseutil/dcfd.c b/parseutil/dcfd.c index d5dd778d7..652b375f7 100644 --- a/parseutil/dcfd.c +++ b/parseutil/dcfd.c @@ -198,7 +198,7 @@ static char skip_adjust = 1; /* discard first adjustment (bad samples) */ #define DCFB_ANNOUNCE 0x0001 /* switch time zone warning (DST switch) */ #define DCFB_DST 0x0002 /* DST in effect */ #define DCFB_LEAP 0x0004 /* LEAP warning (1 hour prior to occurrence) */ -#define DCFB_ALTERNATE 0x0008 /* alternate antenna used */ +#define DCFB_CALLBIT 0x0008 /* "call bit" used to signalize irregularities in the control facilities */ struct clocktime /* clock time broken up from time code */ { @@ -267,7 +267,8 @@ typedef struct clocktime clocktime_t; * Second Contents * 0 - 10 AM: free, FM: 0 * 11 - 14 free - * 15 R - alternate antenna + * 15 R - "call bit" used to signalize irregularities in the control facilities + * (until 2003 indicated transmission via alternate antenna) * 16 A1 - expect zone change (1 hour before) * 17 - 18 Z1,Z2 - time zone * 0 0 illegal @@ -301,7 +302,7 @@ typedef struct clocktime clocktime_t; * while the length is given as the difference between the start index and * the start index of the following field. */ -static struct rawdcfcode +static struct rawdcfcode { char offset; /* start bit */ } rawdcfcode[] = @@ -368,7 +369,7 @@ static struct dcfparam { unsigned char onebits[60]; unsigned char zerobits[60]; -} dcfparam = +} dcfparam = { "###############RADMLS1248124P124812P1248121241248112481248P", /* 'ONE' representation */ "--------------------s-------p------p----------------------p" /* 'ZERO' representation */ @@ -391,7 +392,7 @@ ext_bf( register int i, first; first = rawdcfcode[idx].offset; - + for (i = rawdcfcode[idx+1].offset - 1; i >= first; i--) { sum <<= 1; @@ -445,7 +446,7 @@ convert_rawdcf( PRINTF("%-30s", "*** INCOMPLETE"); return CVT_NONE; } - + /* * check Start and Parity bits */ @@ -502,7 +503,7 @@ convert_rawdcf( clock_time->flags |= DCFB_LEAP; if (ext_bf(buffer, DCF_R)) - clock_time->flags |= DCFB_ALTERNATE; + clock_time->flags |= DCFB_CALLBIT; return CVT_OK; } @@ -746,7 +747,7 @@ cvt_rawdcf( * if everything went well so far return the result of the symbolic * conversion routine else just the accumulated errors */ - if (rtc != CVT_NONE) + if (rtc != CVT_NONE) { PRINTF("%-30s", "*** BAD DATA"); } @@ -765,13 +766,13 @@ dcf_to_unixtime( ) { #define SETRTC(_X_) { if (cvtrtc) *cvtrtc = (_X_); } - static int days_of_month[] = + static int days_of_month[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; register int i; time_t t; - + /* * map 2 digit years to 19xx (DCF77 is a 20th century item) */ @@ -854,7 +855,7 @@ dcf_to_unixtime( */ t = TIMES60(t) + clock_time->minute; /* sec */ - + /* * calculate UTC in minutes */ @@ -1254,7 +1255,7 @@ usage( */ static int check_y2k( void ) -{ +{ int year; /* current working year */ int year0 = 1900; /* sarting year for NTP time */ int yearend; /* ending year we test for NTP time. @@ -1313,7 +1314,7 @@ check_y2k( void ) * *a minor difference to arg2 type */ if ( ct.year != year ) { - fprintf( stdout, + fprintf( stdout, "%04d: dcf_to_unixtime(,%d) CORRUPTED ct.year: was %d\n", (int)year, (int)Flag, (int)ct.year ); Error(year); @@ -1323,9 +1324,9 @@ check_y2k( void ) Expected = t * 24 * 60 * 60; if ( Observed != Expected || Flag ) { /* time difference */ - fprintf( stdout, + fprintf( stdout, "%04d: dcf_to_unixtime(,%d) FAILURE: was=%lu s/b=%lu (%ld)\n", - year, (int)Flag, + year, (int)Flag, (unsigned long)Observed, (unsigned long)Expected, ((long)Observed - (long)Expected) ); Error(year); @@ -1351,7 +1352,7 @@ rawdcf_init( * Here a voltage between the DTR and the RTS line is used. Unfortunately * the name has changed from CIOCM_DTR to TIOCM_DTR recently. */ - + #ifdef TIOCM_DTR int sl232 = TIOCM_DTR; /* turn on DTR for power supply */ #else @@ -1445,7 +1446,7 @@ main( errs=1; } break; - + case 'd': if (ac > 1) { @@ -1458,8 +1459,8 @@ main( errs=1; } break; - - case 'Y': + + case 'Y': errs=check_y2k(); exit( errs ? 1 : 0 ); @@ -1526,7 +1527,7 @@ main( unsigned int rtc = CVT_NONE; rawdcf_init(fd); - + timeout.tv_sec = 1; timeout.tv_usec = 500000; @@ -1567,7 +1568,7 @@ main( */ if (!interactive) detach(); - + /* * get syslog() initialized */ @@ -1625,7 +1626,7 @@ main( it.it_interval.tv_usec = 0; it.it_value.tv_sec = 1<= first; i--) { sum <<= 1; @@ -223,7 +224,7 @@ convert_rawdcf( printf("%-30s", "*** INCOMPLETE"); return CVT_NONE; } - + /* * check Start and Parity bits */ @@ -274,7 +275,7 @@ convert_rawdcf( clock_time->flags |= DCFB_LEAP; if (ext_bf(buffer, DCF_R)) - clock_time->flags |= DCFB_ALTERNATE; + clock_time->flags |= DCFB_CALLBIT; return CVT_OK; } @@ -490,7 +491,7 @@ main( wday[clock_time.wday], (int)clock_time.hour, (int)clock_time.minute, (int)i, (int)clock_time.day, (int)clock_time.month, (int)clock_time.year, - (clock_time.flags & DCFB_ALTERNATE) ? "R" : "_", + (clock_time.flags & DCFB_CALLBIT) ? "R" : "_", (clock_time.flags & DCFB_ANNOUNCE) ? "A" : "_", (clock_time.flags & DCFB_DST) ? "D" : "_", (clock_time.flags & DCFB_LEAP) ? "L" : "_"