Changeset 1834 in ntrip for trunk/BNC/RTCM3/RTCM3coDecoder.cpp


Ignore:
Timestamp:
May 7, 2009, 11:27:19 AM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/RTCM3coDecoder.cpp

    r1833 r1834  
    4747#include "bncapp.h"
    4848#include "bncsettings.h"
     49#include "rtcm3torinex.h"
    4950
    5051using namespace std;
     
    163164        }
    164165        else {
    165           double GPSdaysec = fmod(_GPSweeks, 86400.0);
    166           int    weekDay   = int((_GPSweeks - GPSdaysec) / 86400.0);
    167           if      (GPSdaysec > _co.GLONASSEpochTime + 3600.0) {
     166
     167          // Guess GPS week and sec using system time
     168          // ----------------------------------------
     169          int week;
     170          double sec;
     171          currentGPSWeeks(week, sec);
     172          int weekDay      = int(sec/86400.0);
     173          int GPSDaySecHlp = int(sec) - weekDay * 86400;
     174
     175          // cout << "week, sec " << week << " " << sec << endl;
     176
     177          // Second of day (GPS time) from Glonass Epoch
     178          // -------------------------------------------
     179          QDate date = dateAndTimeFromGPSweek(week, sec).date();
     180          int leapSecond = gnumleap(date.year(), date.month(), date.day());
     181          int GPSDaySec  = _co.GLONASSEpochTime + 3 * 3600 + leapSecond;
     182
     183          // cout << "GlonassEpoch, leapSecond, GPSDaySec "
     184          //      << _co.GLONASSEpochTime << " " << leapSecond << " "
     185          //      << GPSDaySec << endl;
     186
     187          // Handle the difference between system clock and correction epoch
     188          // ---------------------------------------------------------------
     189          if      (GPSDaySec < GPSDaySecHlp - 3600) {
    168190            weekDay += 1;
    169             if (weekDay > 6) {
    170               weekDay = 0;
    171               GPSweek += 1;
    172             }
    173191          }
    174           else if (GPSdaysec < _co.GLONASSEpochTime - 3600.0) {
     192          else if (GPSDaySec > GPSDaySecHlp + 3600) {
    175193            weekDay -= 1;
    176             if (weekDay < 0) {
    177               weekDay = 6;
    178               GPSweek -= 1;
    179             }
    180           }
    181           _GPSweeks = weekDay * 86400.0 + _co.GLONASSEpochTime;
     194          }
     195
     196          _GPSweeks = weekDay * 86400.0 + GPSDaySec;
     197                     
     198          // cout << "weekDay, _GPSweeks " << weekDay << " "
     199          //      << _GPSweeks << endl;
    182200        }
    183201
Note: See TracChangeset for help on using the changeset viewer.