Changeset 2346 in ntrip


Ignore:
Timestamp:
Mar 1, 2010, 2:48:25 PM (14 years ago)
Author:
stoecker
Message:

updated

Location:
trunk/rtcm3torinex
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/rtcm3torinex/rtcm3torinex.c

    r1824 r2346  
    11/*
    22  Converter for RTCM3 data to RINEX.
    3   $Id: rtcm3torinex.c,v 1.36 2008/12/03 08:33:16 stoecker Exp $
     3  $Id: rtcm3torinex.c,v 1.31 2010/01/16 11:07:57 weber Exp $
    44  Copyright (C) 2005-2008 by Dirk Stöcker <stoecker@alberding.eu>
    55
     
    4848#endif
    4949
     50#ifndef isinf
     51#define isinf(x) 0
     52#endif
     53
    5054#include "rtcm3torinex.h"
    5155
    5256/* CVS revision and version */
    53 static char revisionstr[] = "$Revision: 1.36 $";
     57static char revisionstr[] = "$Revision: 1.31 $";
    5458
    5559#ifndef COMPILEDATE
     
    234238}
    235239
    236 static int gnumleap(int year, int month, int day)
     240int gnumleap(int year, int month, int day)
    237241{
    238242  int ls = 0;
     
    247251}
    248252
    249 void updatetime(int *week, int *tow, int tk, int fixnumleap)
     253/* Convert Moscow time into UTC (fixnumleap == 1) or GPS (fixnumleap == 0) */
     254void updatetime(int *week, int *secOfWeek, int mSecOfWeek, int fixnumleap)
    250255{
    251256  int y,m,d,k,l, nul;
    252   unsigned int j = *week*(7*24*60*60) + *tow + 5*24*60*60+3*60*60;
     257  unsigned int j = *week*(7*24*60*60) + *secOfWeek + 5*24*60*60+3*60*60;
    253258  int glo_daynumber = 0, glo_timeofday;
    254259  for(y = 1980; j >= (unsigned int)(k = (l = (365+longyear(y,0)))*24*60*60)
     
    268273  glo_timeofday = j-nul;
    269274
    270   if(tk < 5*60*1000 && glo_timeofday > 23*60*60)
    271     *tow += 24*60*60;
    272   else if(glo_timeofday < 5*60 && tk > 23*60*60*1000)
    273     *tow -= 24*60*60;
    274   *tow += tk/1000-glo_timeofday;
     275  if(mSecOfWeek < 5*60*1000 && glo_timeofday > 23*60*60)
     276    *secOfWeek += 24*60*60;
     277  else if(glo_timeofday < 5*60 && mSecOfWeek > 23*60*60*1000)
     278    *secOfWeek -= 24*60*60;
     279  *secOfWeek += mSecOfWeek/1000-glo_timeofday;
    275280  if(fixnumleap)
    276     *tow -= nul;
    277   if(*tow < 0) {*tow += 24*60*60*7; --*week; }
    278   if(*tow >= 24*60*60*7) {*tow -= 24*60*60*7; ++*week; }
     281    *secOfWeek -= nul;
     282  if(*secOfWeek < 0) {*secOfWeek += 24*60*60*7; --*week; }
     283  if(*secOfWeek >= 24*60*60*7) {*secOfWeek -= 24*60*60*7; ++*week; }
    279284}
    280285
     
    635640        GETBITS(i,27) /* tk */
    636641
    637         updatetime(&handle->GPSWeek, &handle->GPSTOW, i, 0);
     642        updatetime(&handle->GPSWeek, &handle->GPSTOW, i, 0); /* Moscow -> GPS */
    638643        i = handle->GPSTOW*1000;
    639644        if(gnss->week && (gnss->timeofweek != i || gnss->week
     
    671676          GETBITS(code, 1)
    672677          GETBITS(freq, 5)
     678
     679          gnss->channels[num] = freq - 7;
     680
    673681          if(code)
    674682          {
     
    828836  } data;
    829837  int  numheaders;
    830 };
    831 
    832 struct converttimeinfo {
    833   int second;    /* seconds of GPS time [0..59] */
    834   int minute;    /* minutes of GPS time [0..59] */
    835   int hour;      /* hour of GPS time [0..24] */
    836   int day;       /* day of GPS time [1..28..30(31)*/
    837   int month;     /* month of GPS time [1..12]*/
    838   int year;      /* year of GPS time [1980..] */
    839838};
    840839
     
    13981397            struct converttimeinfo cti;
    13991398
    1400             updatetime(&w, &tow, e->tb*1000, 1);
     1399            updatetime(&w, &tow, e->tb*1000, 1);  /* Moscow - > UTC */
    14011400            converttime(&cti, w, tow);
    14021401
     
    16851684
    16861685#ifndef NO_RTCM3_MAIN
    1687 static char datestr[]     = "$Date: 2008/12/03 08:33:16 $";
     1686static char datestr[]     = "$Date: 2010/01/16 11:07:57 $";
    16881687
    16891688/* The string, which is send as agent in HTTP request */
  • trunk/rtcm3torinex/rtcm3torinex.h

    r1237 r2346  
    44/*
    55  Converter for RTCM3 data to RINEX.
    6   $Id: rtcm3torinex.h,v 1.14 2008/11/10 18:07:35 weber Exp $
     6  $Id: rtcm3torinex.h,v 1.19 2010/01/12 12:13:23 mervart Exp $
    77  Copyright (C) 2005-2006 by Dirk Stöcker <stoecker@alberding.eu>
    88
     
    2222  or read http://www.gnu.org/licenses/gpl.txt
    2323*/
     24
     25#include <stdio.h>
    2426
    2527#define PRN_GPS_START             1
     
    98100#define GNSSDF_LOCKLOSSL2     (1<<30)  /* lost lock on L2 */
    99101
     102struct converttimeinfo {
     103  int second;    /* seconds of GPS time [0..59] */
     104  int minute;    /* minutes of GPS time [0..59] */
     105  int hour;      /* hour of GPS time [0..24] */
     106  int day;       /* day of GPS time [1..28..30(31)*/
     107  int month;     /* month of GPS time [1..12]*/
     108  int year;      /* year of GPS time [1980..] */
     109};
     110
    100111struct gnssdata {
    101112  int    flags;              /* GPSF_xxx */
     
    106117  int    dataflags[24];      /* GPSDF_xxx */
    107118  int    satellites[24];     /* SV - IDs */
     119  int    channels[24];       /* Glonass channels - valid of Glonass SV only */
    108120  int    snrL1[24];          /* Important: all the 5 SV-specific fields must */
    109121  int    snrL2[24];          /* have the same SV-order */
     
    230242#endif /* PRINTFARG */
    231243
     244int gnumleap(int year, int month, int day);
     245void updatetime(int *week, int *tow, int tk, int fixnumleap);
     246void converttime(struct converttimeinfo *c, int week, int tow);
     247
    232248void HandleHeader(struct RTCM3ParserData *Parser);
    233249int RTCM3Parser(struct RTCM3ParserData *handle);
Note: See TracChangeset for help on using the changeset viewer.