Changeset 3303 in ntrip for trunk/BNC/bncgetthread.cpp


Ignore:
Timestamp:
Jun 17, 2011, 4:34:25 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncgetthread.cpp

    r3302 r3303  
    443443      QListIterator<t_obs> it(_decoder->_obsList);
    444444      bool firstObs = true;
    445       QMap<QString, long> prnLastEpo;
    446445      while (it.hasNext()) {
    447446        const t_obs& obs = it.next();
     447
     448        QString prn  = QString("%1%2").arg(obs.satSys)
     449                                      .arg(obs.satNum, 2, 10, QChar('0'));
     450        long iSec    = long(floor(obs.GPSWeeks+0.5));
     451        long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
    448452
    449453        // Check observation epoch
    450454        // -----------------------
    451455        if (!_rawFile && !dynamic_cast<gpssDecoder*>(_decoder)) {
    452           int week;
     456          int    week;
    453457          double sec;
    454458          currentGPSWeeks(week, sec);
    455           const double secPerWeek = 7.0 * 24.0 * 3600.0;
    456          
    457           double currSec = week        * secPerWeek + sec;
    458           double obsSec  = obs.GPSWeek * secPerWeek + obs.GPSWeeks;
    459 
     459          long currTime = week * 7*24*3600 + sec;
    460460          const double maxDt = 600.0;
    461 
    462           if (fabs(currSec - obsSec) > maxDt) {
     461          if (fabs(currTime - obsTime) > maxDt) {
    463462              emit( newMessage(_staID + ": Wrong observation epoch(s)", false) );
    464463            continue;
     
    468467        // Check observations comming twice (e.g. KOUR0 Problem)
    469468        // -----------------------------------------------------
    470         long iSec    = long(floor(obs.GPSWeeks+0.5));
    471         long newTime = obs.GPSWeek * 7*24*3600 + iSec;
    472         QString prn  = QString("%1%2").arg(obs.satSys)
    473                                       .arg(obs.satNum, 2, 10, QChar('0'));
    474 
    475         QMap<QString, long>::const_iterator it = prnLastEpo.find(prn);
    476         if (it == prnLastEpo.end()) {
    477           prnLastEpo[prn] = newTime;
     469        QMap<QString, long>::const_iterator it = _prnLastEpo.find(prn);
     470        if (it == _prnLastEpo.end()) {
     471          _prnLastEpo[prn] = obsTime;
    478472        }
    479473        else {
    480474          long oldTime = it.value();
    481           if      (newTime <  oldTime) {
     475          if      (obsTime <  oldTime) {
    482476            emit( newMessage(_staID +
    483477               ": old observation " + prn.toAscii(), false));
    484478            continue;
    485479          }
    486           else if (newTime == oldTime) {
     480          else if (obsTime == oldTime) {
    487481            emit( newMessage(_staID +
    488482               ": observation comming more than once " + prn.toAscii(), false));
     
    490484          }
    491485          else {
    492             prnLastEpo[prn] = newTime;
     486            _prnLastEpo[prn] = obsTime;
    493487          }
    494488        }
     
    500494            _rnx->deepCopy(obs);
    501495          }
    502           _rnx->dumpEpoch(newTime);
     496          _rnx->dumpEpoch(obsTime);
    503497        }
    504498     
Note: See TracChangeset for help on using the changeset viewer.