Home | History | Annotate | Line # | Download | only in libparse
clk_trimtsip.c revision 1.1.1.2.4.2.2.1
      1  1.1.1.2.4.2.2.1       snj /*	$NetBSD: clk_trimtsip.c,v 1.1.1.2.4.2.2.1 2017/04/20 06:42:18 snj Exp $	*/
      2              1.1    kardel 
      3              1.1    kardel /*
      4              1.1    kardel  * /src/NTP/REPOSITORY/ntp4-dev/libparse/clk_trimtsip.c,v 4.19 2009/11/01 10:47:49 kardel RELEASE_20091101_A
      5              1.1    kardel  *
      6              1.1    kardel  * clk_trimtsip.c,v 4.19 2009/11/01 10:47:49 kardel RELEASE_20091101_A
      7              1.1    kardel  *
      8              1.1    kardel  * Trimble TSIP support
      9              1.1    kardel  * Thanks to Sven Dietrich for providing test hardware
     10              1.1    kardel  *
     11              1.1    kardel  * Copyright (c) 1995-2009 by Frank Kardel <kardel <AT> ntp.org>
     12      1.1.1.2.4.2       snj  * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
     13              1.1    kardel  *
     14              1.1    kardel  * Redistribution and use in source and binary forms, with or without
     15              1.1    kardel  * modification, are permitted provided that the following conditions
     16              1.1    kardel  * are met:
     17              1.1    kardel  * 1. Redistributions of source code must retain the above copyright
     18              1.1    kardel  *    notice, this list of conditions and the following disclaimer.
     19              1.1    kardel  * 2. Redistributions in binary form must reproduce the above copyright
     20              1.1    kardel  *    notice, this list of conditions and the following disclaimer in the
     21              1.1    kardel  *    documentation and/or other materials provided with the distribution.
     22              1.1    kardel  * 3. Neither the name of the author nor the names of its contributors
     23              1.1    kardel  *    may be used to endorse or promote products derived from this software
     24              1.1    kardel  *    without specific prior written permission.
     25              1.1    kardel  *
     26              1.1    kardel  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     27              1.1    kardel  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28              1.1    kardel  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29              1.1    kardel  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     30              1.1    kardel  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31              1.1    kardel  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32              1.1    kardel  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33              1.1    kardel  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34              1.1    kardel  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35              1.1    kardel  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36              1.1    kardel  * SUCH DAMAGE.
     37              1.1    kardel  *
     38              1.1    kardel  */
     39              1.1    kardel 
     40              1.1    kardel #ifdef HAVE_CONFIG_H
     41              1.1    kardel # include <config.h>
     42              1.1    kardel #endif
     43              1.1    kardel 
     44              1.1    kardel #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_TRIMTSIP)
     45              1.1    kardel 
     46              1.1    kardel #include "ntp_syslog.h"
     47              1.1    kardel #include "ntp_types.h"
     48              1.1    kardel #include "ntp_fp.h"
     49          1.1.1.2  christos #include "timevalops.h"
     50              1.1    kardel #include "ntp_calendar.h"
     51              1.1    kardel #include "ntp_machine.h"
     52              1.1    kardel #include "ntp_stdlib.h"
     53              1.1    kardel 
     54              1.1    kardel #include "parse.h"
     55              1.1    kardel 
     56              1.1    kardel #ifndef PARSESTREAM
     57              1.1    kardel # include <stdio.h>
     58              1.1    kardel #else
     59              1.1    kardel # include "sys/parsestreams.h"
     60              1.1    kardel #endif
     61              1.1    kardel 
     62              1.1    kardel #include "ascii.h"
     63              1.1    kardel #include "binio.h"
     64              1.1    kardel #include "ieee754io.h"
     65              1.1    kardel #include "trimble.h"
     66              1.1    kardel 
     67              1.1    kardel /*
     68              1.1    kardel  * Trimble low level TSIP parser / time converter
     69              1.1    kardel  *
     70              1.1    kardel  * The receiver uses a serial message protocol called Trimble Standard
     71              1.1    kardel  * Interface Protocol (it can support others but this driver only supports
     72              1.1    kardel  * TSIP). Messages in this protocol have the following form:
     73              1.1    kardel  *
     74              1.1    kardel  * <DLE><id> ... <data> ... <DLE><ETX>
     75              1.1    kardel  *
     76              1.1    kardel  * Any bytes within the <data> portion of value 10 hex (<DLE>) are doubled
     77              1.1    kardel  * on transmission and compressed back to one on reception. Otherwise
     78              1.1    kardel  * the values of data bytes can be anything. The serial interface is RS-422
     79              1.1    kardel  * asynchronous using 9600 baud, 8 data bits with odd party (**note** 9 bits
     80              1.1    kardel  * in total!), and 1 stop bit. The protocol supports byte, integer, single,
     81              1.1    kardel  * and double datatypes. Integers are two bytes, sent most significant first.
     82              1.1    kardel  * Singles are IEEE754 single precision floating point numbers (4 byte) sent
     83              1.1    kardel  * sign & exponent first. Doubles are IEEE754 double precision floating point
     84              1.1    kardel  * numbers (8 byte) sent sign & exponent first.
     85              1.1    kardel  * The receiver supports a large set of messages, only a very small subset of
     86              1.1    kardel  * which is used here.
     87              1.1    kardel  *
     88              1.1    kardel  * From this module the following are recognised:
     89              1.1    kardel  *
     90              1.1    kardel  *  ID    Description
     91              1.1    kardel  *
     92              1.1    kardel  *  41    GPS Time
     93              1.1    kardel  *  46    Receiver health
     94              1.1    kardel  *  4F    UTC correction data (used to get leap second warnings)
     95              1.1    kardel  *
     96              1.1    kardel  * All others are accepted but ignored for time conversion - they are passed up to higher layers.
     97              1.1    kardel  *
     98              1.1    kardel  */
     99              1.1    kardel 
    100              1.1    kardel static offsets_t trim_offsets = { 0, 1, 2, 3, 4, 5, 6, 7 };
    101              1.1    kardel 
    102              1.1    kardel struct trimble
    103              1.1    kardel {
    104              1.1    kardel 	u_char  t_in_pkt;	/* first DLE received */
    105              1.1    kardel 	u_char  t_dle;		/* subsequent DLE received */
    106              1.1    kardel 	u_short t_week;		/* GPS week */
    107              1.1    kardel 	u_short t_weekleap;	/* GPS week of next/last week */
    108              1.1    kardel 	u_short t_dayleap;	/* day in week */
    109              1.1    kardel 	u_short t_gpsutc;	/* GPS - UTC offset */
    110              1.1    kardel 	u_short t_gpsutcleap;	/* offset at next/last leap */
    111              1.1    kardel 	u_char  t_operable;	/* receiver feels OK */
    112              1.1    kardel 	u_char  t_mode;		/* actual operating mode */
    113              1.1    kardel 	u_char  t_leap;		/* possible leap warning */
    114              1.1    kardel         u_char  t_utcknown;	/* utc offset known */
    115              1.1    kardel };
    116              1.1    kardel 
    117              1.1    kardel #define STATUS_BAD    0		/* BAD or UNINITIALIZED receiver status */
    118              1.1    kardel #define STATUS_UNSAFE 1		/* not enough receivers for full precision */
    119              1.1    kardel #define STATUS_SYNC   2		/* enough information for good operation */
    120              1.1    kardel 
    121      1.1.1.2.4.2       snj static unsigned long inp_tsip (parse_t *, char, timestamp_t *);
    122              1.1    kardel static unsigned long cvt_trimtsip (unsigned char *, int, struct format *, clocktime_t *, void *);
    123              1.1    kardel 
    124              1.1    kardel struct clockformat clock_trimtsip =
    125              1.1    kardel {
    126              1.1    kardel 	inp_tsip,		/* Trimble TSIP input handler */
    127              1.1    kardel 	cvt_trimtsip,		/* Trimble TSIP conversion */
    128              1.1    kardel 	pps_one,		/* easy PPS monitoring */
    129              1.1    kardel 	0,			/* no configuration data */
    130              1.1    kardel 	"Trimble TSIP",
    131              1.1    kardel 	400,			/* input buffer */
    132              1.1    kardel 	sizeof(struct trimble)	/* private data */
    133              1.1    kardel };
    134              1.1    kardel 
    135              1.1    kardel #define ADDSECOND	0x01
    136              1.1    kardel #define DELSECOND	0x02
    137              1.1    kardel 
    138              1.1    kardel static unsigned long
    139              1.1    kardel inp_tsip(
    140              1.1    kardel 	 parse_t      *parseio,
    141      1.1.1.2.4.2       snj 	 char         ch,
    142              1.1    kardel 	 timestamp_t  *tstamp
    143              1.1    kardel 	)
    144              1.1    kardel {
    145              1.1    kardel 	struct trimble *t = (struct trimble *)parseio->parse_pdata;
    146              1.1    kardel 
    147              1.1    kardel 	if (!t)
    148              1.1    kardel 	    return PARSE_INP_SKIP;		/* local data not allocated - sigh! */
    149              1.1    kardel 
    150              1.1    kardel 	if (!t->t_in_pkt && ch != DLE) {
    151              1.1    kardel 		/* wait for start of packet */
    152              1.1    kardel 		return PARSE_INP_SKIP;
    153              1.1    kardel 	}
    154              1.1    kardel 
    155              1.1    kardel 	if ((parseio->parse_index >= (parseio->parse_dsize - 2)) ||
    156              1.1    kardel 	    (parseio->parse_dtime.parse_msglen >= (sizeof(parseio->parse_dtime.parse_msg) - 2)))
    157              1.1    kardel 		{		/* OVERFLOW - DROP! */
    158              1.1    kardel 			t->t_in_pkt = t->t_dle = 0;
    159              1.1    kardel 			parseio->parse_index = 0;
    160              1.1    kardel 			parseio->parse_dtime.parse_msglen = 0;
    161              1.1    kardel 		return PARSE_INP_SKIP;
    162              1.1    kardel 	}
    163              1.1    kardel 
    164              1.1    kardel 	switch (ch) {
    165              1.1    kardel 	    case DLE:
    166              1.1    kardel 		if (!t->t_in_pkt) {
    167              1.1    kardel 			t->t_dle = 0;
    168              1.1    kardel 			t->t_in_pkt = 1;
    169              1.1    kardel 			parseio->parse_index = 0;
    170              1.1    kardel 			parseio->parse_data[parseio->parse_index++] = ch;
    171              1.1    kardel 			parseio->parse_dtime.parse_msglen = 0;
    172              1.1    kardel 			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
    173              1.1    kardel 			parseio->parse_dtime.parse_stime = *tstamp; /* pick up time stamp at packet start */
    174              1.1    kardel 		} else if (t->t_dle) {
    175              1.1    kardel 			/* Double DLE -> insert a DLE */
    176              1.1    kardel 			t->t_dle = 0;
    177              1.1    kardel 			parseio->parse_data[parseio->parse_index++] = DLE;
    178              1.1    kardel 			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = DLE;
    179              1.1    kardel 		} else
    180              1.1    kardel 		    t->t_dle = 1;
    181              1.1    kardel 		break;
    182              1.1    kardel 
    183              1.1    kardel 	    case ETX:
    184              1.1    kardel 		if (t->t_dle) {
    185              1.1    kardel 			/* DLE,ETX -> end of packet */
    186              1.1    kardel 			parseio->parse_data[parseio->parse_index++] = DLE;
    187              1.1    kardel 			parseio->parse_data[parseio->parse_index] = ch;
    188      1.1.1.2.4.2       snj 			parseio->parse_ldsize = (u_short) (parseio->parse_index + 1);
    189              1.1    kardel 			memcpy(parseio->parse_ldata, parseio->parse_data, parseio->parse_ldsize);
    190              1.1    kardel 			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = DLE;
    191              1.1    kardel 			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
    192              1.1    kardel 			t->t_in_pkt = t->t_dle = 0;
    193              1.1    kardel 			return PARSE_INP_TIME|PARSE_INP_DATA;
    194              1.1    kardel 		}
    195              1.1    kardel 		/*FALLTHROUGH*/
    196              1.1    kardel 
    197              1.1    kardel 	    default:		/* collect data */
    198              1.1    kardel 		t->t_dle = 0;
    199              1.1    kardel 		parseio->parse_data[parseio->parse_index++] = ch;
    200              1.1    kardel 		parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
    201              1.1    kardel 	}
    202              1.1    kardel 
    203              1.1    kardel   return PARSE_INP_SKIP;
    204              1.1    kardel }
    205      1.1.1.2.4.2       snj 
    206      1.1.1.2.4.2       snj static short
    207              1.1    kardel getshort(
    208              1.1    kardel 	 unsigned char *p
    209              1.1    kardel 	 )
    210              1.1    kardel {
    211      1.1.1.2.4.2       snj 	return (short) get_msb_short(&p);
    212              1.1    kardel }
    213              1.1    kardel 
    214              1.1    kardel /*
    215              1.1    kardel  * cvt_trimtsip
    216              1.1    kardel  *
    217              1.1    kardel  * convert TSIP type format
    218              1.1    kardel  */
    219              1.1    kardel static unsigned long
    220              1.1    kardel cvt_trimtsip(
    221              1.1    kardel 	     unsigned char *buffer,
    222              1.1    kardel 	     int            size,
    223              1.1    kardel 	     struct format *format,
    224              1.1    kardel 	     clocktime_t   *clock_time,
    225              1.1    kardel 	     void          *local
    226              1.1    kardel 	     )
    227              1.1    kardel {
    228              1.1    kardel         register struct trimble *t = (struct trimble *)local; /* get local data space */
    229              1.1    kardel #define mb(_X_) (buffer[2+(_X_)]) /* shortcut for buffer access */
    230              1.1    kardel 	register u_char cmd;
    231              1.1    kardel 
    232              1.1    kardel 	clock_time->flags = 0;
    233              1.1    kardel 
    234              1.1    kardel 	if (!t) {
    235              1.1    kardel 		return CVT_NONE;		/* local data not allocated - sigh! */
    236              1.1    kardel 	}
    237              1.1    kardel 
    238              1.1    kardel 	if ((size < 4) ||
    239              1.1    kardel 	    (buffer[0]      != DLE) ||
    240              1.1    kardel 	    (buffer[size-1] != ETX) ||
    241              1.1    kardel 	    (buffer[size-2] != DLE))
    242              1.1    kardel 	{
    243              1.1    kardel 		printf("TRIMBLE BAD packet, size %d:\n", size);
    244              1.1    kardel 		return CVT_NONE;
    245              1.1    kardel 	}
    246              1.1    kardel 	else
    247              1.1    kardel 	{
    248              1.1    kardel 		unsigned char *bp;
    249              1.1    kardel 		cmd = buffer[1];
    250      1.1.1.2.4.2       snj 
    251              1.1    kardel 		    switch(cmd)
    252              1.1    kardel 		    {
    253              1.1    kardel 		    case CMD_RCURTIME:
    254              1.1    kardel 			    {			/* GPS time */
    255  1.1.1.2.4.2.2.1       snj 				    l_fp  secs;
    256  1.1.1.2.4.2.2.1       snj 				    u_int week = getshort((unsigned char *)&mb(4));
    257  1.1.1.2.4.2.2.1       snj 				    l_fp  utcoffset;
    258  1.1.1.2.4.2.2.1       snj 				    l_fp  gpstime;
    259              1.1    kardel 
    260              1.1    kardel 				    bp = &mb(0);
    261              1.1    kardel 				    if (fetch_ieee754(&bp, IEEE_SINGLE, &secs, trim_offsets) != IEEE_OK)
    262              1.1    kardel 					    return CVT_FAIL|CVT_BADFMT;
    263      1.1.1.2.4.2       snj 
    264              1.1    kardel 				    if ((secs.l_i <= 0) ||
    265              1.1    kardel 					(t->t_utcknown == 0))
    266              1.1    kardel 				    {
    267              1.1    kardel 					    clock_time->flags = PARSEB_POWERUP;
    268              1.1    kardel 					    return CVT_OK;
    269              1.1    kardel 				    }
    270      1.1.1.2.4.2       snj 				    if (week < GPSWRAP) {
    271      1.1.1.2.4.2       snj 					    week += GPSWEEKS;
    272              1.1    kardel 				    }
    273              1.1    kardel 
    274              1.1    kardel 				    /* time OK */
    275              1.1    kardel 
    276              1.1    kardel 				    /* fetch UTC offset */
    277              1.1    kardel 				    bp = &mb(6);
    278              1.1    kardel 				    if (fetch_ieee754(&bp, IEEE_SINGLE, &utcoffset, trim_offsets) != IEEE_OK)
    279              1.1    kardel 					    return CVT_FAIL|CVT_BADFMT;
    280      1.1.1.2.4.2       snj 
    281              1.1    kardel 				    L_SUB(&secs, &utcoffset); /* adjust GPS time to UTC time */
    282              1.1    kardel 
    283              1.1    kardel 				    gpstolfp((unsigned short)week, (unsigned short)0,
    284              1.1    kardel 					     secs.l_ui, &gpstime);
    285              1.1    kardel 
    286              1.1    kardel 				    gpstime.l_uf = secs.l_uf;
    287              1.1    kardel 
    288              1.1    kardel 				    clock_time->utctime = gpstime.l_ui - JAN_1970;
    289              1.1    kardel 
    290              1.1    kardel 				    TSFTOTVU(gpstime.l_uf, clock_time->usecond);
    291              1.1    kardel 
    292              1.1    kardel 				    if (t->t_leap == ADDSECOND)
    293              1.1    kardel 					clock_time->flags |= PARSEB_LEAPADD;
    294      1.1.1.2.4.2       snj 
    295              1.1    kardel 				    if (t->t_leap == DELSECOND)
    296              1.1    kardel 					clock_time->flags |= PARSEB_LEAPDEL;
    297      1.1.1.2.4.2       snj 
    298              1.1    kardel 				    switch (t->t_operable)
    299              1.1    kardel 				      {
    300              1.1    kardel 				      case STATUS_SYNC:
    301              1.1    kardel 					clock_time->flags &= ~(PARSEB_POWERUP|PARSEB_NOSYNC);
    302              1.1    kardel 					break;
    303              1.1    kardel 
    304              1.1    kardel 				      case STATUS_UNSAFE:
    305              1.1    kardel 					clock_time->flags |= PARSEB_NOSYNC;
    306              1.1    kardel 					break;
    307              1.1    kardel 
    308              1.1    kardel 				      case STATUS_BAD:
    309              1.1    kardel 					clock_time->flags |= PARSEB_NOSYNC|PARSEB_POWERUP;
    310              1.1    kardel 					break;
    311              1.1    kardel 				      }
    312      1.1.1.2.4.2       snj 
    313              1.1    kardel 				    if (t->t_mode == 0)
    314              1.1    kardel 					    clock_time->flags |= PARSEB_POSITION;
    315      1.1.1.2.4.2       snj 
    316              1.1    kardel 				    clock_time->flags |= PARSEB_S_LEAP|PARSEB_S_POSITION;
    317      1.1.1.2.4.2       snj 
    318              1.1    kardel 				    return CVT_OK;
    319              1.1    kardel 
    320              1.1    kardel 			    } /* case 0x41 */
    321              1.1    kardel 
    322              1.1    kardel 		    case CMD_RRECVHEALTH:
    323              1.1    kardel 			    {
    324              1.1    kardel 				    /* TRIMBLE health */
    325              1.1    kardel 				    u_char status = mb(0);
    326              1.1    kardel 
    327              1.1    kardel 				    switch (status)
    328              1.1    kardel 				    {
    329              1.1    kardel 				      case 0x00: /* position fixes */
    330              1.1    kardel 					t->t_operable = STATUS_SYNC;
    331              1.1    kardel 					break;
    332              1.1    kardel 
    333              1.1    kardel 				      case 0x09: /* 1 satellite */
    334              1.1    kardel 				      case 0x0A: /* 2 satellites */
    335              1.1    kardel 				      case 0x0B: /* 3 satellites */
    336              1.1    kardel 					t->t_operable = STATUS_UNSAFE;
    337              1.1    kardel 					break;
    338              1.1    kardel 
    339              1.1    kardel 				      default:
    340              1.1    kardel 					t->t_operable = STATUS_BAD;
    341              1.1    kardel 					break;
    342              1.1    kardel 				    }
    343              1.1    kardel 				    t->t_mode = status;
    344              1.1    kardel 			    }
    345              1.1    kardel 			    break;
    346              1.1    kardel 
    347              1.1    kardel 		    case CMD_RUTCPARAM:
    348              1.1    kardel 			    {
    349              1.1    kardel 			            l_fp t0t;
    350              1.1    kardel 				    unsigned char *lbp;
    351      1.1.1.2.4.2       snj 
    352              1.1    kardel 				    /* UTC correction data - derive a leap warning */
    353      1.1.1.2.4.2       snj 				    int tls   = t->t_gpsutc     = (u_short) getshort((unsigned char *)&mb(12)); /* current leap correction (GPS-UTC) */
    354      1.1.1.2.4.2       snj 				    int tlsf  = t->t_gpsutcleap = (u_short) getshort((unsigned char *)&mb(24)); /* new leap correction */
    355      1.1.1.2.4.2       snj 
    356      1.1.1.2.4.2       snj 				    t->t_weekleap   = (u_short) getshort((unsigned char *)&mb(20)); /* week no of leap correction */
    357      1.1.1.2.4.2       snj 				    if (t->t_weekleap < GPSWRAP)
    358      1.1.1.2.4.2       snj 				      t->t_weekleap = (u_short)(t->t_weekleap + GPSWEEKS);
    359      1.1.1.2.4.2       snj 
    360      1.1.1.2.4.2       snj 				    t->t_dayleap    = (u_short) getshort((unsigned char *)&mb(22)); /* day in week of leap correction */
    361      1.1.1.2.4.2       snj 				    t->t_week = (u_short) getshort((unsigned char *)&mb(18)); /* current week no */
    362      1.1.1.2.4.2       snj 				    if (t->t_week < GPSWRAP)
    363      1.1.1.2.4.2       snj 				      t->t_week = (u_short)(t->t_weekleap + GPSWEEKS);
    364              1.1    kardel 
    365              1.1    kardel 				    lbp = (unsigned char *)&mb(14); /* last update time */
    366              1.1    kardel 				    if (fetch_ieee754(&lbp, IEEE_SINGLE, &t0t, trim_offsets) != IEEE_OK)
    367              1.1    kardel 					    return CVT_FAIL|CVT_BADFMT;
    368              1.1    kardel 
    369              1.1    kardel 				    t->t_utcknown = t0t.l_ui != 0;
    370      1.1.1.2.4.2       snj 
    371              1.1    kardel 				    if ((t->t_utcknown) && /* got UTC information */
    372              1.1    kardel 					(tlsf != tls)   && /* something will change */
    373              1.1    kardel 					((t->t_weekleap - t->t_week) < 5)) /* and close in the future */
    374              1.1    kardel 				    {
    375              1.1    kardel 					    /* generate a leap warning */
    376              1.1    kardel 					    if (tlsf > tls)
    377              1.1    kardel 						t->t_leap = ADDSECOND;
    378              1.1    kardel 					    else
    379              1.1    kardel 						t->t_leap = DELSECOND;
    380              1.1    kardel 				    }
    381              1.1    kardel 				    else
    382              1.1    kardel 				    {
    383              1.1    kardel 					    t->t_leap = 0;
    384              1.1    kardel 				    }
    385              1.1    kardel 			    }
    386              1.1    kardel 			    break;
    387              1.1    kardel 
    388              1.1    kardel 		    default:
    389              1.1    kardel 			    /* it's validly formed, but we don't care about it! */
    390              1.1    kardel 			    break;
    391              1.1    kardel 		}
    392              1.1    kardel 	}
    393              1.1    kardel 	return CVT_SKIP;
    394              1.1    kardel }
    395              1.1    kardel 
    396              1.1    kardel #else /* not (REFCLOCK && CLOCK_PARSE && CLOCK_TRIMTSIP && !PARSESTREAM) */
    397              1.1    kardel int clk_trimtsip_bs;
    398              1.1    kardel #endif /* not (REFCLOCK && CLOCK_PARSE && CLOCK_TRIMTSIP && !PARSESTREAM) */
    399              1.1    kardel 
    400              1.1    kardel /*
    401              1.1    kardel  * History:
    402              1.1    kardel  *
    403              1.1    kardel  * clk_trimtsip.c,v
    404              1.1    kardel  * Revision 4.19  2009/11/01 10:47:49  kardel
    405              1.1    kardel  * de-P()
    406              1.1    kardel  *
    407              1.1    kardel  * Revision 4.18  2009/11/01 08:46:46  kardel
    408              1.1    kardel  * clarify case FALLTHROUGH
    409              1.1    kardel  *
    410              1.1    kardel  * Revision 4.17  2005/04/16 17:32:10  kardel
    411              1.1    kardel  * update copyright
    412              1.1    kardel  *
    413              1.1    kardel  * Revision 4.16  2004/11/14 15:29:41  kardel
    414              1.1    kardel  * support PPSAPI, upgrade Copyright to Berkeley style
    415              1.1    kardel  *
    416              1.1    kardel  * Revision 4.13  1999/11/28 09:13:51  kardel
    417              1.1    kardel  * RECON_4_0_98F
    418              1.1    kardel  *
    419              1.1    kardel  * Revision 4.12  1999/02/28 13:00:08  kardel
    420              1.1    kardel  * *** empty log message ***
    421              1.1    kardel  *
    422              1.1    kardel  * Revision 4.11  1999/02/28 11:47:54  kardel
    423              1.1    kardel  * (struct trimble): new member t_utcknown
    424              1.1    kardel  * (cvt_trimtsip): fixed status monitoring, bad receiver states are
    425              1.1    kardel  * now recognized
    426              1.1    kardel  *
    427              1.1    kardel  * Revision 4.10  1999/02/27 15:57:15  kardel
    428              1.1    kardel  * use mmemcpy instead of bcopy
    429              1.1    kardel  *
    430              1.1    kardel  * Revision 4.9  1999/02/21 12:17:42  kardel
    431              1.1    kardel  * 4.91f reconcilation
    432              1.1    kardel  *
    433              1.1    kardel  * Revision 4.8  1998/11/15 20:27:58  kardel
    434              1.1    kardel  * Release 4.0.73e13 reconcilation
    435              1.1    kardel  *
    436              1.1    kardel  * Revision 4.7  1998/08/16 18:49:20  kardel
    437              1.1    kardel  * (cvt_trimtsip): initial kernel capable version (no more floats)
    438              1.1    kardel  * (clock_trimtsip =): new format name
    439              1.1    kardel  *
    440              1.1    kardel  * Revision 4.6  1998/08/09 22:26:05  kardel
    441              1.1    kardel  * Trimble TSIP support
    442              1.1    kardel  *
    443              1.1    kardel  * Revision 4.5  1998/08/02 10:37:05  kardel
    444              1.1    kardel  * working TSIP parser
    445              1.1    kardel  *
    446              1.1    kardel  * Revision 4.4  1998/06/28 16:50:40  kardel
    447              1.1    kardel  * (getflt): fixed ENDIAN issue
    448              1.1    kardel  * (getdbl): fixed ENDIAN issue
    449              1.1    kardel  * (getint): use get_msb_short()
    450              1.1    kardel  * (cvt_trimtsip): use gpstolfp() for conversion
    451              1.1    kardel  *
    452              1.1    kardel  * Revision 4.3  1998/06/13 12:07:31  kardel
    453              1.1    kardel  * fix SYSV clock name clash
    454              1.1    kardel  *
    455              1.1    kardel  * Revision 4.2  1998/06/12 15:22:30  kardel
    456              1.1    kardel  * fix prototypes
    457              1.1    kardel  *
    458              1.1    kardel  * Revision 4.1  1998/05/24 09:39:54  kardel
    459              1.1    kardel  * implementation of the new IO handling model
    460              1.1    kardel  *
    461              1.1    kardel  * Revision 4.0  1998/04/10 19:45:32  kardel
    462              1.1    kardel  * Start 4.0 release version numbering
    463              1.1    kardel  *
    464              1.1    kardel  * from V3 1.8 loginfo deleted 1998/04/11 kardel
    465              1.1    kardel  */
    466