]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1787] DCF77's formerly "antenna" bit is "call bit" since 2003.
authorMartin Burnicki <burnicki@ntp.org>
Fri, 20 Mar 2015 10:36:15 +0000 (11:36 +0100)
committerMartin Burnicki <burnicki@ntp.org>
Fri, 20 Mar 2015 10:36:15 +0000 (11:36 +0100)
bk: 550bf81fgY4d3fWg9u0Gsl2pp0-1Ng

ChangeLog
include/parse.h
libparse/clk_meinberg.c
libparse/clk_rawdcf.c
libparse/clk_schmid.c
libparse/parse.c
ntpd/refclock_parse.c
parseutil/dcfd.c
parseutil/testdcf.c

index 7404a0eb6326347063f06610fd271aad2684d08b..fb2bde67253b1d1696508e64039212a884f2e1c0 100644 (file)
--- 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().
 * [Bug 2678] nmea_control() now checks 'refclock_params()' result.
 (4.2.7p481) 2014/11/22 Released by Harlan Stenn <stenn@ntp.org>
 * [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 <stenn@ntp.org>
 * [Bug 2677] PATH_MAX isn't #define'd under Windows.
index aa0fe478776cec9bd2b25ce7570bb44518578631..ca6855d18e58579b4251909e54ac0b37f26f82c3 100644 (file)
@@ -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)
index 4f763fdfe90b4d976fe289a2949b2ee0860ee90e..4047be5e7314fd4d268fa801405299b2de0195b7 100644 (file)
  * <A>             = '!' during the hour preceeding an daylight saving time
  *                       start/end change
  * <L>             = 'A' LEAP second announcement
- * <R>             = 'R' alternate antenna
+ * <R>             = 'R' "call bit" used to signalize irregularities in the control facilities,
+ *                   usually ' ', until 2003 indicated transmission via alternate antenna
  *
  * Meinberg GPS receivers
  *
  * <A>             = '!' during the hour preceeding an daylight saving time
  *                       start/end change
  * <L>             = 'A' LEAP second announcement
- * <R>             = 'R' alternate antenna (reminiscent of PZF535) usually ' '
- * <L>            = 'L' on 23:59:60
+ * <R>             = 'R' "call bit" used to signalize irregularities in the control facilities,
+ *                   usually ' ', until 2003 indicated transmission via alternate antenna
+ *                   (reminiscent of PZF receivers)
+ * <L>             = '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;
        }
index 3c6f9198e3ca00ad929157b01cfc33ef86baf5e3..132fbc33146e203b363786c6cbdddd47546056dc 100644 (file)
@@ -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,
index 41eae2c62c5c7ebb9683c9ace2bea053ccc9ede3..5e303b94c29a0ef06fd44dcee7ff9a0537d4af30 100644 (file)
@@ -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)
index 50781796cfc78cc0793e7d74ebbcf0d29c0d3399..9e663f911f74d12f6bb6722e31218f48d45a5086 100644 (file)
@@ -284,7 +284,7 @@ parse_ioread(
                break;
 
            case PARSE_IO_CS8:
-               ch &= (char) 0xFF;
+               ch &= (char) 0xFFU;
                break;
        }
 
index 3117332ac2b949d897306abfceafb1e1fbd1c7a8..3b0b08281b3f1a93066379ee8dff8902a65040a4 100644 (file)
@@ -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" },
index d5dd778d73fc5ff16c6af825aac672b6c023fb68..652b375f78d7382550b5259b89fa8153c7500670 100644 (file)
@@ -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<<ADJINTERVAL;
                        it.it_value.tv_usec    = 0;
-       
+
                        if (setitimer(ITIMER_REAL, &it, (struct itimerval *)0) == -1)
                        {
                                syslog(LOG_ERR, "setitimer: %m");
@@ -1804,7 +1805,7 @@ main(
                                               wday[clock_time.wday],
                                               clock_time.hour, clock_time.minute, i, clock_time.day, clock_time.month,
                                               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" : "_",
@@ -1836,7 +1837,7 @@ main(
                                    fflush(stdout);
                        }
                } while ((rrc == -1) && (errno == EINTR));
-      
+
                /*
                 * lost IO - sorry guys
                 */
@@ -1846,7 +1847,7 @@ main(
        }
 
        closelog();
-  
+
        return 0;
 }
 
index 9d8ff15a3bd68aaa8c21f90776e1929747a89460..00bf05937fabbca574ec3d86b39d7d228d195f44 100644 (file)
 /*
  * state flags
  */
-#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_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_CALLBIT    0x0008 /* "call bit" used to signalize irregularities in the control facilities */
 
 struct clocktime               /* clock time broken up from time code */
 {
@@ -102,7 +102,8 @@ static char type(unsigned int);
  * 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
@@ -130,7 +131,7 @@ static char type(unsigned int);
 
 static char revision[] = "4.10";
 
-static struct rawdcfcode 
+static struct rawdcfcode
 {
        char offset;                    /* start bit */
 } rawdcfcode[] =
@@ -185,7 +186,7 @@ ext_bf(
        register int i, first;
 
        first = rawdcfcode[idx].offset;
-  
+
        for (i = rawdcfcode[idx+1].offset - 1; i >= 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" : "_"