154359Sroberto/* 2182007Sroberto * /src/NTP/ntp4-dev/parseutil/testdcf.c,v 4.10 2005/08/06 14:18:43 kardel RELEASE_20050806_A 3182007Sroberto * 4182007Sroberto * testdcf.c,v 4.10 2005/08/06 14:18:43 kardel RELEASE_20050806_A 5285612Sdelphij * 654359Sroberto * simple DCF77 100/200ms pulse test program (via 50Baud serial line) 754359Sroberto * 8285612Sdelphij * Copyright (c) 1995-2015 by Frank Kardel <kardel <AT> ntp.org> 9285612Sdelphij * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany 1054359Sroberto * 11182007Sroberto * Redistribution and use in source and binary forms, with or without 12182007Sroberto * modification, are permitted provided that the following conditions 13182007Sroberto * are met: 14182007Sroberto * 1. Redistributions of source code must retain the above copyright 15182007Sroberto * notice, this list of conditions and the following disclaimer. 16182007Sroberto * 2. Redistributions in binary form must reproduce the above copyright 17182007Sroberto * notice, this list of conditions and the following disclaimer in the 18182007Sroberto * documentation and/or other materials provided with the distribution. 19182007Sroberto * 3. Neither the name of the author nor the names of its contributors 20182007Sroberto * may be used to endorse or promote products derived from this software 21182007Sroberto * without specific prior written permission. 22182007Sroberto * 23182007Sroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24182007Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25182007Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26182007Sroberto * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 27182007Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28182007Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29182007Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30182007Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31182007Sroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32182007Sroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33182007Sroberto * SUCH DAMAGE. 34182007Sroberto * 3554359Sroberto */ 3654359Sroberto 37285612Sdelphij#include <config.h> 3882498Sroberto#include "ntp_stdlib.h" 3982498Sroberto 40182007Sroberto#include <sys/ioctl.h> 4154359Sroberto#include <unistd.h> 4254359Sroberto#include <stdio.h> 4354359Sroberto#include <fcntl.h> 4454359Sroberto#include <termios.h> 4554359Sroberto 4654359Sroberto/* 4754359Sroberto * state flags 4854359Sroberto */ 49285612Sdelphij#define DCFB_ANNOUNCE 0x0001 /* switch time zone warning (DST switch) */ 50285612Sdelphij#define DCFB_DST 0x0002 /* DST in effect */ 51285612Sdelphij#define DCFB_LEAP 0x0004 /* LEAP warning (1 hour prior to occurrence) */ 52285612Sdelphij#define DCFB_CALLBIT 0x0008 /* "call bit" used to signalize irregularities in the control facilities */ 5354359Sroberto 5454359Srobertostruct clocktime /* clock time broken up from time code */ 5554359Sroberto{ 5654359Sroberto long wday; 5754359Sroberto long day; 5854359Sroberto long month; 5954359Sroberto long year; 6054359Sroberto long hour; 6154359Sroberto long minute; 6254359Sroberto long second; 6354359Sroberto long usecond; 6454359Sroberto long utcoffset; /* in minutes */ 6554359Sroberto long flags; /* current clock status */ 6654359Sroberto}; 6754359Sroberto 6854359Srobertotypedef struct clocktime clocktime_t; 6954359Sroberto 70182007Srobertostatic char type(unsigned int); 71182007Sroberto 7254359Sroberto#define TIMES10(_X_) (((_X_) << 3) + ((_X_) << 1)) 7354359Sroberto 7454359Sroberto/* 7554359Sroberto * parser related return/error codes 7654359Sroberto */ 7754359Sroberto#define CVT_MASK 0x0000000F /* conversion exit code */ 7854359Sroberto#define CVT_NONE 0x00000001 /* format not applicable */ 7954359Sroberto#define CVT_FAIL 0x00000002 /* conversion failed - error code returned */ 8054359Sroberto#define CVT_OK 0x00000004 /* conversion succeeded */ 8154359Sroberto#define CVT_BADFMT 0x00000010 /* general format error - (unparsable) */ 8254359Sroberto 8354359Sroberto/* 8454359Sroberto * DCF77 raw time code 8554359Sroberto * 8654359Sroberto * From "Zur Zeit", Physikalisch-Technische Bundesanstalt (PTB), Braunschweig 8754359Sroberto * und Berlin, Maerz 1989 8854359Sroberto * 8954359Sroberto * Timecode transmission: 9054359Sroberto * AM: 9154359Sroberto * time marks are send every second except for the second before the 9254359Sroberto * next minute mark 9354359Sroberto * time marks consist of a reduction of transmitter power to 25% 9454359Sroberto * of the nominal level 9554359Sroberto * the falling edge is the time indication (on time) 9654359Sroberto * time marks of a 100ms duration constitute a logical 0 9754359Sroberto * time marks of a 200ms duration constitute a logical 1 9854359Sroberto * FM: 9954359Sroberto * see the spec. (basically a (non-)inverted psuedo random phase shift) 10054359Sroberto * 10154359Sroberto * Encoding: 10254359Sroberto * Second Contents 10354359Sroberto * 0 - 10 AM: free, FM: 0 10454359Sroberto * 11 - 14 free 105285612Sdelphij * 15 R - "call bit" used to signalize irregularities in the control facilities 106285612Sdelphij * (until 2003 indicated transmission via alternate antenna) 10754359Sroberto * 16 A1 - expect zone change (1 hour before) 10854359Sroberto * 17 - 18 Z1,Z2 - time zone 10954359Sroberto * 0 0 illegal 11054359Sroberto * 0 1 MEZ (MET) 11154359Sroberto * 1 0 MESZ (MED, MET DST) 11254359Sroberto * 1 1 illegal 11354359Sroberto * 19 A2 - expect leap insertion/deletion (1 hour before) 11454359Sroberto * 20 S - start of time code (1) 11554359Sroberto * 21 - 24 M1 - BCD (lsb first) Minutes 11654359Sroberto * 25 - 27 M10 - BCD (lsb first) 10 Minutes 11754359Sroberto * 28 P1 - Minute Parity (even) 11854359Sroberto * 29 - 32 H1 - BCD (lsb first) Hours 11954359Sroberto * 33 - 34 H10 - BCD (lsb first) 10 Hours 12054359Sroberto * 35 P2 - Hour Parity (even) 12154359Sroberto * 36 - 39 D1 - BCD (lsb first) Days 12254359Sroberto * 40 - 41 D10 - BCD (lsb first) 10 Days 12354359Sroberto * 42 - 44 DW - BCD (lsb first) day of week (1: Monday -> 7: Sunday) 12454359Sroberto * 45 - 49 MO - BCD (lsb first) Month 12554359Sroberto * 50 MO0 - 10 Months 12654359Sroberto * 51 - 53 Y1 - BCD (lsb first) Years 12754359Sroberto * 54 - 57 Y10 - BCD (lsb first) 10 Years 12854359Sroberto * 58 P3 - Date Parity (even) 12954359Sroberto * 59 - usually missing (minute indication), except for leap insertion 13054359Sroberto */ 13154359Sroberto 132182007Srobertostatic char revision[] = "4.10"; 133182007Sroberto 134285612Sdelphijstatic struct rawdcfcode 13554359Sroberto{ 13654359Sroberto char offset; /* start bit */ 13754359Sroberto} rawdcfcode[] = 13854359Sroberto{ 13954359Sroberto { 0 }, { 15 }, { 16 }, { 17 }, { 19 }, { 20 }, { 21 }, { 25 }, { 28 }, { 29 }, 14054359Sroberto { 33 }, { 35 }, { 36 }, { 40 }, { 42 }, { 45 }, { 49 }, { 50 }, { 54 }, { 58 }, { 59 } 14154359Sroberto}; 14254359Sroberto 14354359Sroberto#define DCF_M 0 14454359Sroberto#define DCF_R 1 14554359Sroberto#define DCF_A1 2 14654359Sroberto#define DCF_Z 3 14754359Sroberto#define DCF_A2 4 14854359Sroberto#define DCF_S 5 14954359Sroberto#define DCF_M1 6 15054359Sroberto#define DCF_M10 7 15154359Sroberto#define DCF_P1 8 15254359Sroberto#define DCF_H1 9 15354359Sroberto#define DCF_H10 10 15454359Sroberto#define DCF_P2 11 15554359Sroberto#define DCF_D1 12 15654359Sroberto#define DCF_D10 13 15754359Sroberto#define DCF_DW 14 15854359Sroberto#define DCF_MO 15 15954359Sroberto#define DCF_MO0 16 16054359Sroberto#define DCF_Y1 17 16154359Sroberto#define DCF_Y10 18 16254359Sroberto#define DCF_P3 19 16354359Sroberto 16454359Srobertostatic struct partab 16554359Sroberto{ 16654359Sroberto char offset; /* start bit of parity field */ 16754359Sroberto} partab[] = 16854359Sroberto{ 16954359Sroberto { 21 }, { 29 }, { 36 }, { 59 } 17054359Sroberto}; 17154359Sroberto 17254359Sroberto#define DCF_P_P1 0 17354359Sroberto#define DCF_P_P2 1 17454359Sroberto#define DCF_P_P3 2 17554359Sroberto 17654359Sroberto#define DCF_Z_MET 0x2 17754359Sroberto#define DCF_Z_MED 0x1 17854359Sroberto 17954359Srobertostatic unsigned long 18054359Srobertoext_bf( 18154359Sroberto register unsigned char *buf, 18254359Sroberto register int idx 18354359Sroberto ) 18454359Sroberto{ 18554359Sroberto register unsigned long sum = 0; 18654359Sroberto register int i, first; 18754359Sroberto 18854359Sroberto first = rawdcfcode[idx].offset; 189285612Sdelphij 19054359Sroberto for (i = rawdcfcode[idx+1].offset - 1; i >= first; i--) 19154359Sroberto { 19254359Sroberto sum <<= 1; 19354359Sroberto sum |= (buf[i] != '-'); 19454359Sroberto } 19554359Sroberto return sum; 19654359Sroberto} 19754359Sroberto 19854359Srobertostatic unsigned 19954359Srobertopcheck( 20054359Sroberto register unsigned char *buf, 20154359Sroberto register int idx 20254359Sroberto ) 20354359Sroberto{ 20454359Sroberto register int i,last; 20554359Sroberto register unsigned psum = 1; 20654359Sroberto 20754359Sroberto last = partab[idx+1].offset; 20854359Sroberto 20954359Sroberto for (i = partab[idx].offset; i < last; i++) 21054359Sroberto psum ^= (buf[i] != '-'); 21154359Sroberto 21254359Sroberto return psum; 21354359Sroberto} 21454359Sroberto 21554359Srobertostatic unsigned long 21654359Srobertoconvert_rawdcf( 21754359Sroberto register unsigned char *buffer, 21854359Sroberto register int size, 21954359Sroberto register clocktime_t *clock_time 22054359Sroberto ) 22154359Sroberto{ 22254359Sroberto if (size < 57) 22354359Sroberto { 22454359Sroberto printf("%-30s", "*** INCOMPLETE"); 22554359Sroberto return CVT_NONE; 22654359Sroberto } 227285612Sdelphij 22854359Sroberto /* 22954359Sroberto * check Start and Parity bits 23054359Sroberto */ 23154359Sroberto if ((ext_bf(buffer, DCF_S) == 1) && 23254359Sroberto pcheck(buffer, DCF_P_P1) && 23354359Sroberto pcheck(buffer, DCF_P_P2) && 23454359Sroberto pcheck(buffer, DCF_P_P3)) 23554359Sroberto { 23654359Sroberto /* 23754359Sroberto * buffer OK 23854359Sroberto */ 23954359Sroberto 24054359Sroberto clock_time->flags = 0; 24154359Sroberto clock_time->usecond= 0; 24254359Sroberto clock_time->second = 0; 24354359Sroberto clock_time->minute = ext_bf(buffer, DCF_M10); 24454359Sroberto clock_time->minute = TIMES10(clock_time->minute) + ext_bf(buffer, DCF_M1); 24554359Sroberto clock_time->hour = ext_bf(buffer, DCF_H10); 24654359Sroberto clock_time->hour = TIMES10(clock_time->hour) + ext_bf(buffer, DCF_H1); 24754359Sroberto clock_time->day = ext_bf(buffer, DCF_D10); 24854359Sroberto clock_time->day = TIMES10(clock_time->day) + ext_bf(buffer, DCF_D1); 24954359Sroberto clock_time->month = ext_bf(buffer, DCF_MO0); 25054359Sroberto clock_time->month = TIMES10(clock_time->month) + ext_bf(buffer, DCF_MO); 25154359Sroberto clock_time->year = ext_bf(buffer, DCF_Y10); 25254359Sroberto clock_time->year = TIMES10(clock_time->year) + ext_bf(buffer, DCF_Y1); 25354359Sroberto clock_time->wday = ext_bf(buffer, DCF_DW); 25454359Sroberto 25554359Sroberto switch (ext_bf(buffer, DCF_Z)) 25654359Sroberto { 25754359Sroberto case DCF_Z_MET: 25854359Sroberto clock_time->utcoffset = -60; 25954359Sroberto break; 26054359Sroberto 26154359Sroberto case DCF_Z_MED: 26254359Sroberto clock_time->flags |= DCFB_DST; 26354359Sroberto clock_time->utcoffset = -120; 26454359Sroberto break; 26554359Sroberto 26654359Sroberto default: 26754359Sroberto printf("%-30s", "*** BAD TIME ZONE"); 26854359Sroberto return CVT_FAIL|CVT_BADFMT; 26954359Sroberto } 27054359Sroberto 27154359Sroberto if (ext_bf(buffer, DCF_A1)) 27254359Sroberto clock_time->flags |= DCFB_ANNOUNCE; 27354359Sroberto 27454359Sroberto if (ext_bf(buffer, DCF_A2)) 27554359Sroberto clock_time->flags |= DCFB_LEAP; 27654359Sroberto 27754359Sroberto if (ext_bf(buffer, DCF_R)) 278285612Sdelphij clock_time->flags |= DCFB_CALLBIT; 27954359Sroberto 28054359Sroberto return CVT_OK; 28154359Sroberto } 28254359Sroberto else 28354359Sroberto { 28454359Sroberto /* 28554359Sroberto * bad format - not for us 28654359Sroberto */ 28754359Sroberto printf("%-30s", "*** BAD FORMAT (invalid/parity)"); 28854359Sroberto return CVT_FAIL|CVT_BADFMT; 28954359Sroberto } 29054359Sroberto} 29154359Sroberto 292182007Srobertostatic char 29354359Srobertotype( 29454359Sroberto unsigned int c 29554359Sroberto ) 29654359Sroberto{ 29754359Sroberto c ^= 0xFF; 298182007Sroberto return (c >= 0xF); 29954359Sroberto} 30054359Sroberto 30154359Srobertostatic const char *wday[8] = 30254359Sroberto{ 30354359Sroberto "??", 30454359Sroberto "Mo", 30554359Sroberto "Tu", 30654359Sroberto "We", 30754359Sroberto "Th", 30854359Sroberto "Fr", 30954359Sroberto "Sa", 31054359Sroberto "Su" 31154359Sroberto}; 31254359Sroberto 31354359Srobertostatic char pat[] = "-\\|/"; 31454359Sroberto 31554359Sroberto#define LINES (24-2) /* error lines after which the two headlines are repeated */ 31654359Sroberto 31754359Srobertoint 31854359Srobertomain( 31954359Sroberto int argc, 32054359Sroberto char *argv[] 32154359Sroberto ) 32254359Sroberto{ 32354359Sroberto if ((argc != 2) && (argc != 3)) 32454359Sroberto { 32554359Sroberto fprintf(stderr, "usage: %s [-f|-t|-ft|-tf] <device>\n", argv[0]); 32654359Sroberto exit(1); 32754359Sroberto } 32854359Sroberto else 32954359Sroberto { 33054359Sroberto unsigned char c; 33154359Sroberto char *file; 33254359Sroberto int fd; 33354359Sroberto int offset = 15; 33454359Sroberto int trace = 0; 33554359Sroberto int errs = LINES+1; 33654359Sroberto 33754359Sroberto /* 33854359Sroberto * SIMPLE(!) argument "parser" 33954359Sroberto */ 34054359Sroberto if (argc == 3) 34154359Sroberto { 34254359Sroberto if (strcmp(argv[1], "-f") == 0) 34354359Sroberto offset = 0; 34454359Sroberto if (strcmp(argv[1], "-t") == 0) 34554359Sroberto trace = 1; 34654359Sroberto if ((strcmp(argv[1], "-ft") == 0) || 34754359Sroberto (strcmp(argv[1], "-tf") == 0)) 34854359Sroberto { 34954359Sroberto offset = 0; 35054359Sroberto trace = 1; 35154359Sroberto } 35254359Sroberto file = argv[2]; 35354359Sroberto } 35454359Sroberto else 35554359Sroberto { 35654359Sroberto file = argv[1]; 35754359Sroberto } 35854359Sroberto 35954359Sroberto fd = open(file, O_RDONLY); 36054359Sroberto if (fd == -1) 36154359Sroberto { 36254359Sroberto perror(file); 36354359Sroberto exit(1); 36454359Sroberto } 36554359Sroberto else 36654359Sroberto { 36754359Sroberto int i; 36854359Sroberto#ifdef TIOCM_RTS 36954359Sroberto int on = TIOCM_RTS; 37054359Sroberto#endif 37154359Sroberto struct timeval t, tt, tlast; 37254359Sroberto char buf[61]; 37354359Sroberto clocktime_t clock_time; 37454359Sroberto struct termios term; 37554359Sroberto int rtc = CVT_NONE; 37654359Sroberto 37754359Sroberto if (tcgetattr(fd, &term) == -1) 37854359Sroberto { 37954359Sroberto perror("tcgetattr"); 38054359Sroberto exit(1); 38154359Sroberto } 38254359Sroberto 38354359Sroberto memset(term.c_cc, 0, sizeof(term.c_cc)); 38454359Sroberto term.c_cc[VMIN] = 1; 38554359Sroberto#ifdef NO_PARENB_IGNPAR /* Was: defined(SYS_IRIX4) || defined (SYS_IRIX5) */ 38654359Sroberto /* somehow doesn't grok PARENB & IGNPAR (mj) */ 387182007Sroberto term.c_cflag = CS8|CREAD|CLOCAL; 38854359Sroberto#else 389182007Sroberto term.c_cflag = CS8|CREAD|CLOCAL|PARENB; 39054359Sroberto#endif 39154359Sroberto term.c_iflag = IGNPAR; 39254359Sroberto term.c_oflag = 0; 39354359Sroberto term.c_lflag = 0; 39454359Sroberto 395182007Sroberto cfsetispeed(&term, B50); 396182007Sroberto cfsetospeed(&term, B50); 397182007Sroberto 39854359Sroberto if (tcsetattr(fd, TCSANOW, &term) == -1) 39954359Sroberto { 40054359Sroberto perror("tcsetattr"); 40154359Sroberto exit(1); 40254359Sroberto } 40354359Sroberto 40454359Sroberto#ifdef I_POP 40554359Sroberto while (ioctl(fd, I_POP, 0) == 0) 40654359Sroberto ; 40754359Sroberto#endif 40854359Sroberto#if defined(TIOCMBIC) && defined(TIOCM_RTS) 40954359Sroberto if (ioctl(fd, TIOCMBIC, (caddr_t)&on) == -1) 41054359Sroberto { 41154359Sroberto perror("TIOCM_RTS"); 41254359Sroberto } 41354359Sroberto#endif 41454359Sroberto 415182007Sroberto printf(" DCF77 monitor %s - Copyright (C) 1993-2005, Frank Kardel\n\n", revision); 41654359Sroberto 41754359Sroberto clock_time.hour = 0; 41854359Sroberto clock_time.minute = 0; 41954359Sroberto clock_time.day = 0; 42054359Sroberto clock_time.wday = 0; 42154359Sroberto clock_time.month = 0; 42254359Sroberto clock_time.year = 0; 42354359Sroberto clock_time.flags = 0; 42454359Sroberto buf[60] = '\0'; 42554359Sroberto for ( i = 0; i < 60; i++) 42654359Sroberto buf[i] = '.'; 42754359Sroberto 42854359Sroberto gettimeofday(&tlast, 0L); 42954359Sroberto i = 0; 43054359Sroberto while (read(fd, &c, 1) == 1) 43154359Sroberto { 43254359Sroberto gettimeofday(&t, 0L); 43354359Sroberto tt = t; 43454359Sroberto t.tv_sec -= tlast.tv_sec; 43554359Sroberto t.tv_usec -= tlast.tv_usec; 43654359Sroberto if (t.tv_usec < 0) 43754359Sroberto { 43854359Sroberto t.tv_usec += 1000000; 43954359Sroberto t.tv_sec -= 1; 44054359Sroberto } 44154359Sroberto 44254359Sroberto if (errs > LINES) 44354359Sroberto { 44454359Sroberto printf(" %s", &"PTB private....RADMLSMin....PHour..PMDay..DayMonthYear....P\n"[offset]); 44554359Sroberto printf(" %s", &"---------------RADMLS1248124P124812P1248121241248112481248P\n"[offset]); 44654359Sroberto errs = 0; 44754359Sroberto } 44854359Sroberto 44954359Sroberto if (t.tv_sec > 1 || 45054359Sroberto (t.tv_sec == 1 && 45154359Sroberto t.tv_usec > 500000)) 45254359Sroberto { 45354359Sroberto printf("%c %.*s ", pat[i % (sizeof(pat)-1)], 59 - offset, &buf[offset]); 45454359Sroberto 45554359Sroberto if ((rtc = convert_rawdcf((unsigned char *)buf, i, &clock_time)) != CVT_OK) 45654359Sroberto { 45754359Sroberto printf("\n"); 45854359Sroberto clock_time.hour = 0; 45954359Sroberto clock_time.minute = 0; 46054359Sroberto clock_time.day = 0; 46154359Sroberto clock_time.wday = 0; 46254359Sroberto clock_time.month = 0; 46354359Sroberto clock_time.year = 0; 46454359Sroberto clock_time.flags = 0; 46554359Sroberto errs++; 46654359Sroberto } 46754359Sroberto 46854359Sroberto if (((c^0xFF)+1) & (c^0xFF)) 46954359Sroberto buf[0] = '?'; 47054359Sroberto else 47154359Sroberto buf[0] = type(c) ? '#' : '-'; 47254359Sroberto 47354359Sroberto for ( i = 1; i < 60; i++) 47454359Sroberto buf[i] = '.'; 47554359Sroberto 47654359Sroberto i = 0; 47754359Sroberto } 47854359Sroberto else 47954359Sroberto { 48054359Sroberto if (((c^0xFF)+1) & (c^0xFF)) 48154359Sroberto buf[i] = '?'; 48254359Sroberto else 48354359Sroberto buf[i] = type(c) ? '#' : '-'; 48454359Sroberto 48554359Sroberto printf("%c %.*s ", pat[i % (sizeof(pat)-1)], 59 - offset, &buf[offset]); 48654359Sroberto } 48754359Sroberto 48854359Sroberto if (rtc == CVT_OK) 48954359Sroberto { 49054359Sroberto printf("%s, %2d:%02d:%02d, %d.%02d.%02d, <%s%s%s%s>", 49154359Sroberto wday[clock_time.wday], 49254359Sroberto (int)clock_time.hour, (int)clock_time.minute, (int)i, (int)clock_time.day, (int)clock_time.month, 49354359Sroberto (int)clock_time.year, 494285612Sdelphij (clock_time.flags & DCFB_CALLBIT) ? "R" : "_", 49554359Sroberto (clock_time.flags & DCFB_ANNOUNCE) ? "A" : "_", 49654359Sroberto (clock_time.flags & DCFB_DST) ? "D" : "_", 49754359Sroberto (clock_time.flags & DCFB_LEAP) ? "L" : "_" 49854359Sroberto ); 49954359Sroberto if (trace && (i == 0)) 50054359Sroberto { 50154359Sroberto printf("\n"); 50254359Sroberto errs++; 50354359Sroberto } 50454359Sroberto } 50554359Sroberto 50654359Sroberto printf("\r"); 50754359Sroberto 50854359Sroberto if (i < 60) 50954359Sroberto { 51054359Sroberto i++; 51154359Sroberto } 51254359Sroberto 51354359Sroberto tlast = tt; 51454359Sroberto 51554359Sroberto fflush(stdout); 51654359Sroberto } 51754359Sroberto close(fd); 51854359Sroberto } 51954359Sroberto } 52054359Sroberto return 0; 52154359Sroberto} 522182007Sroberto 523182007Sroberto/* 524182007Sroberto * History: 525182007Sroberto * 526182007Sroberto * testdcf.c,v 527182007Sroberto * Revision 4.10 2005/08/06 14:18:43 kardel 528182007Sroberto * cleanup warnings 529182007Sroberto * 530182007Sroberto * Revision 4.9 2005/08/06 14:14:38 kardel 531182007Sroberto * document revision on startup 532182007Sroberto * 533182007Sroberto * Revision 4.8 2005/08/06 14:10:08 kardel 534182007Sroberto * fix setting of baud rate 535182007Sroberto * 536182007Sroberto * Revision 4.7 2005/04/16 17:32:10 kardel 537182007Sroberto * update copyright 538182007Sroberto * 539182007Sroberto * Revision 4.6 2004/11/14 15:29:42 kardel 540182007Sroberto * support PPSAPI, upgrade Copyright to Berkeley style 541182007Sroberto * 542182007Sroberto */ 543