Changeset 1942 in ntrip


Ignore:
Timestamp:
Nov 12, 2009, 1:58:38 PM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncutils.cpp

    r1836 r1942  
    8989void currentGPSWeeks(int& week, double& sec) {
    9090
    91   QDateTime currDateTime;
    92   int leapsecond = 0;
     91  QDateTime currDateTimeGPS;
    9392
    9493  if ( ((bncApp*) qApp)->_currentDateAndTimeGPS ) {
    95     currDateTime = *(((bncApp*) qApp)->_currentDateAndTimeGPS);
     94    currDateTimeGPS = *(((bncApp*) qApp)->_currentDateAndTimeGPS);
    9695  }
    9796  else {
    98     currDateTime = QDateTime::currentDateTime().toUTC();
    99     QDate date = currDateTime.date();
    100     leapsecond = gnumleap(date.year(), date.month(), date.day());
     97    currDateTimeGPS = QDateTime::currentDateTime().toUTC();
     98    QDate hlp       = currDateTimeGPS.date();
     99    currDateTimeGPS = currDateTimeGPS.addSecs(gnumleap(hlp.year(),
     100                                                     hlp.month(), hlp.day()));
    101101  }
    102102
    103   QDate     currDate = currDateTime.date();
    104   QTime     currTime = currDateTime.time();
     103  QDate currDateGPS = currDateTimeGPS.date();
     104  QTime currTimeGPS = currDateTimeGPS.time();
    105105
    106   week = int( (double(currDate.toJulianDay()) - 2444244.5) / 7 );
     106  week = int( (double(currDateGPS.toJulianDay()) - 2444244.5) / 7 );
    107107
    108   sec = (currDate.dayOfWeek() % 7) * 24.0 * 3600.0 +
    109         currTime.hour()                   * 3600.0 +
    110         currTime.minute()                 *   60.0 +
    111         currTime.second()                          +
    112         currTime.msec()                   / 1000.0 +
    113         leapsecond;
     108  sec = (currDateGPS.dayOfWeek() % 7) * 24.0 * 3600.0 +
     109        currTimeGPS.hour()                   * 3600.0 +
     110        currTimeGPS.minute()                 *   60.0 +
     111        currTimeGPS.second()                          +
     112        currTimeGPS.msec()                   / 1000.0;
    114113}
    115114
Note: See TracChangeset for help on using the changeset viewer.