clk_rcc8000.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* /src/NTP/REPOSITORY/v4/libparse/clk_rcc8000.c,v 3.5 1997/01/19 12:44:40 kardel Exp
*
* clk_rcc8000.c,v 3.5 1997/01/19 12:44:40 kardel Exp
*
* Radiocode Clocks Ltd RCC 8000 Intelligent Off-Air Master Clock support
*
* Created by R.E.Broughton from clk_trimtaip.c
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "ntp_fp.h"
#include "ntp_unixtime.h"
#include "ntp_calendar.h"
#include "parse.h"
/* Type II Serial Output format
*
* 0000000000111111111122222222223 / char
* 0123456789012345678901234567890 \ posn
* 33 44 55 666 00 11 22 7 Parse
* : : . / / rn Check
* "15:50:36.534 30/09/94 273 5 A\x0d\x0a"
*
* DDD - Day of year number
* W - Day of week number (Sunday is 0)
* P is the Status. See comment below for details.
*/
static struct format rcc8000_fmt =
{ { { 13, 2 }, {16, 2}, { 19, 2}, /* Day, Month, Year */
{ 0, 2 }, { 3, 2}, { 6, 2}, /* Hour, Minute, Second */
{ 9, 3 }, {28, 1}, { 0, 0}, /* uSec, Status (Valid,Reject,BST,Leapyear) */ },
" : : . / / \r\n",
/*"15:50:36.534 30/09/94 273 5 A\x0d\x0a" */
0
};
static unsigned long cvt_rcc8000();
{
(unsigned long (*)())0, /* no input handling */
cvt_rcc8000, /* Radiocode clock conversion */
syn_simple, /* easy time stamps for RS232 (fallback) */
(unsigned long (*)())0, /* no direct PPS monitoring */
(unsigned long (*)())0, /* no time code synthesizer monitoring */
(void *)&rcc8000_fmt, /* conversion configuration */
"Radiocode RCC8000",
31, /* string buffer */
0, /* no private data */
{ 0, 0},
'0',
'\n',
'0'
};
static unsigned long
register char *buffer;
register int size;
register clocktime_t *clock;
{
) return CVT_FAIL|CVT_BADFMT;
/*
* buffer[28] is the ASCII representation of a hex character ( 0 through F )
* The four bits correspond to:
* 8 - Valid Time
* 4 - Reject Code
* 2 - British Summer Time (receiver set to emit GMT all year.)
* 1 - Leap year
*/
#define RCC8000_VALID 0x8
#define RCC8000_REJECT 0x4
#define RCC8000_BST 0x2
#define RCC8000_LEAPY 0x1
{
register int flag;
if (!(flag & RCC8000_VALID))
/* other flags not used */
}
return CVT_OK;
}
#else /* not (REFCLOCK && (PARSE || PARSEPPS) && CLOCK_RCC8000) */
int clk_rcc8000_bs;
#endif /* not (REFCLOCK && (PARSE || PARSEPPS) && CLOCK_RCC8000) */
/*
* History:
*
* clk_rcc8000.c,v
* Revision 3.5 1997/01/19 12:44:40 kardel
* 3-5.88.1 reconcilation
*
* Revision 3.4 1996/11/24 20:09:45 kardel
* RELEASE_5_86_12_2 reconcilation
*
* Revision 3.3 1995/02/16 22:37:08 kardel
* LONG -> long - somehow missed this bugger
*
* Revision 3.2 1994/10/16 18:55:52 kardel
* integrate RCC8000 modifications from R. E. Broughton
*
* Revision 3.1 1994/10/03 21:59:24 kardel
* 3.4e cleanup/integration
*
*/