Index: trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 6553)
+++ trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 6556)
@@ -191,5 +191,5 @@
       if (irc == GCOBR_OK || irc == GCOBR_MESSAGEFOLLOWS ) {
 
-        setReferenceTime(); // sets _lastTime
+        setEpochTime(); // sets _lastTime
  
         if (_lastTime.valid()) { 
@@ -238,14 +238,15 @@
       t_orbCorr orbCorr;
       orbCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID);
-      orbCorr._staID    = _staID.toAscii().data();
-      orbCorr._iod      = _clkOrb.Sat[ii].IOD;
-      orbCorr._time     = _lastTime;
-      orbCorr._system   = 'R';
-      orbCorr._xr[0]    = _clkOrb.Sat[ii].Orbit.DeltaRadial;
-      orbCorr._xr[1]    = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack;
-      orbCorr._xr[2]    = _clkOrb.Sat[ii].Orbit.DeltaCrossTrack;
-      orbCorr._dotXr[0] = _clkOrb.Sat[ii].Orbit.DotDeltaRadial;
-      orbCorr._dotXr[1] = _clkOrb.Sat[ii].Orbit.DotDeltaAlongTrack;
-      orbCorr._dotXr[2] = _clkOrb.Sat[ii].Orbit.DotDeltaCrossTrack;
+      orbCorr._staID     = _staID.toAscii().data();
+      orbCorr._iod       = _clkOrb.Sat[ii].IOD;
+      orbCorr._time      = _lastTime;
+      orbCorr._updateInt = _clkOrb.UpdateInterval;
+      orbCorr._system    = 'R';
+      orbCorr._xr[0]     = _clkOrb.Sat[ii].Orbit.DeltaRadial;
+      orbCorr._xr[1]     = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack;
+      orbCorr._xr[2]     = _clkOrb.Sat[ii].Orbit.DeltaCrossTrack;
+      orbCorr._dotXr[0]  = _clkOrb.Sat[ii].Orbit.DotDeltaRadial;
+      orbCorr._dotXr[1]  = _clkOrb.Sat[ii].Orbit.DotDeltaAlongTrack;
+      orbCorr._dotXr[2]  = _clkOrb.Sat[ii].Orbit.DotDeltaCrossTrack;
 
       _orbCorrections[_lastTime].push_back(orbCorr);
@@ -265,4 +266,5 @@
       clkCorr._staID      = _staID.toAscii().data();
       clkCorr._time       = _lastTime;
+      clkCorr._updateInt  = _clkOrb.UpdateInterval;
       clkCorr._dClk       = _clkOrb.Sat[ii].Clock.DeltaA0 / t_CST::c;
       clkCorr._dotDClk    = _clkOrb.Sat[ii].Clock.DeltaA1 / t_CST::c;
@@ -285,7 +287,8 @@
       if (_lastClkCorrections.contains(prn)) {
         t_clkCorr clkCorr;
-        clkCorr        = _lastClkCorrections[prn];
-        clkCorr._time  = _lastTime;
-        clkCorr._dClk  +=_clkOrb.Sat[ii].hrclock / t_CST::c;
+        clkCorr            = _lastClkCorrections[prn];
+        clkCorr._time      = _lastTime;
+        clkCorr._updateInt = _clkOrb.UpdateInterval;
+        clkCorr._dClk     += _clkOrb.Sat[ii].hrclock / t_CST::c;
         if (_IODs.contains(clkCorr._prn)) {
           clkCorr._iod = _IODs[clkCorr._prn];
@@ -311,6 +314,7 @@
     t_satCodeBias satCodeBias;
     satCodeBias._prn.set(sysCh, _codeBias.Sat[ii].ID);
-    satCodeBias._staID = _staID.toAscii().data();
-    satCodeBias._time  = _lastTime;
+    satCodeBias._staID     = _staID.toAscii().data();
+    satCodeBias._time      = _lastTime;
+    satCodeBias._updateInt = _codeBias.UpdateInterval;
     for (unsigned jj = 0; jj < _codeBias.Sat[ii].NumberOfCodeBiases; jj++) {
       const CodeBias::BiasSat::CodeBiasEntry& biasEntry = _codeBias.Sat[ii].Biases[jj];
@@ -342,4 +346,5 @@
     satPhaseBias._staID      = _staID.toAscii().data();
     satPhaseBias._time       = _lastTime;
+    satPhaseBias._updateInt  = _phaseBias.UpdateInterval;
     satPhaseBias._yawDeg     = _phaseBias.Sat[ii].YawAngle * 180.0 / M_PI;
     satPhaseBias._yawDegRate = _phaseBias.Sat[ii].YawRate * 180.0 / M_PI;
@@ -363,4 +368,5 @@
   if (_vTEC.NumLayers > 0) {
     _vTecMap[_lastTime]._time  = _lastTime;
+    _vTecMap[_lastTime]._updateInt =  _vTEC.UpdateInterval;
     _vTecMap[_lastTime]._staID = _staID.toAscii().data();
     for (unsigned ii = 0; ii < _vTEC.NumLayers; ii++) {
@@ -463,55 +469,30 @@
 //
 ////////////////////////////////////////////////////////////////////////////
-void RTCM3coDecoder::setReferenceTime() {
+void RTCM3coDecoder::setEpochTime() {
 
   _lastTime.reset();
 
-  const QVector<int> updateInt = QVector<int>()  << 1 << 2 << 5 << 10 << 15 << 30
-                                                 << 60 << 120 << 240 << 300 << 600
-                                                 << 900 << 1800 << 3600 << 7200
-                                                 << 10800;
   double epoSecGPS = -1.0;
   double epoSecGlo = -1.0;
   if      (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
     epoSecGPS = _clkOrb.EpochTime[CLOCKORBIT_SATGPS];        // 0 .. 604799 s
-    if (_clkOrb.UpdateInterval) {
-      epoSecGPS += 0.5 * updateInt[_clkOrb.UpdateInterval];
-    }
   }
   else if (_codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
     epoSecGPS = _codeBias.EpochTime[CLOCKORBIT_SATGPS];      // 0 .. 604799 s  
-    if (_codeBias.UpdateInterval) {
-      epoSecGPS += 0.5 * updateInt[_codeBias.UpdateInterval];
-    }
   }
   else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
     epoSecGPS = _phaseBias.EpochTime[CLOCKORBIT_SATGPS];     // 0 .. 604799 s  
-    if (_phaseBias.UpdateInterval) {
-      epoSecGPS += 0.5 * updateInt[_phaseBias.UpdateInterval];
-    }
   }
   else if (_vTEC.NumLayers > 0) {
     epoSecGPS = _vTEC.EpochTime;                             // 0 .. 604799 s  
-    if (_vTEC.UpdateInterval) {
-      epoSecGPS += 0.5 * updateInt[_vTEC.UpdateInterval];
-    }
   }
   else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
     epoSecGlo = _clkOrb.EpochTime[CLOCKORBIT_SATGLONASS];    // 0 .. 86399 s
-    if (_clkOrb.UpdateInterval) {
-      epoSecGlo += 0.5 * updateInt[_clkOrb.UpdateInterval];
-    }
   }
   else if (_codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
     epoSecGlo = _codeBias.EpochTime[CLOCKORBIT_SATGLONASS];  // 0 .. 86399 s
-    if (_codeBias.UpdateInterval) {
-      epoSecGlo += 0.5 * updateInt[_codeBias.UpdateInterval];
-    }
   }
   else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
     epoSecGlo = _phaseBias.EpochTime[CLOCKORBIT_SATGLONASS]; // 0 .. 86399 s
-    if (_phaseBias.UpdateInterval) {
-      epoSecGlo += 0.5 * updateInt[_phaseBias.UpdateInterval];
-    }
   }
 
Index: trunk/BNC/src/RTCM3/RTCM3coDecoder.h
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 6553)
+++ trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 6556)
@@ -54,5 +54,5 @@
  private:
   void reset();
-  void setReferenceTime();
+  void setEpochTime();
   void sendResults();
   void reopen();
Index: trunk/BNC/src/ephemeris.cpp
===================================================================
--- trunk/BNC/src/ephemeris.cpp	(revision 6553)
+++ trunk/BNC/src/ephemeris.cpp	(revision 6556)
@@ -47,5 +47,8 @@
     return failure;
   }
-
+  const QVector<int> updateInt = QVector<int>()  << 1 << 2 << 5 << 10 << 15 << 30
+                                                 << 60 << 120 << 240 << 300 << 600
+                                                 << 900 << 1800 << 3600 << 7200
+                                                 << 10800;
   xc.ReSize(4);
   vv.ReSize(3);
@@ -55,6 +58,8 @@
   if (useCorr) {
     if (_orbCorr && _clkCorr) {
-
       double dtO = tt - _orbCorr->_time;
+      if (_orbCorr->_updateInt) {
+        dtO -= (0.5 * updateInt[_orbCorr->_updateInt]);
+      }
       ColumnVector dx(3);
       dx[0] = _orbCorr->_xr[0] + _orbCorr->_dotXr[0] * dtO;
@@ -71,4 +76,7 @@
 
       double dtC = tt - _clkCorr->_time;
+      if (_clkCorr->_updateInt) {
+        dtC -= (0.5 * updateInt[_clkCorr->_updateInt]);
+      }
       xc[3] += _clkCorr->_dClk + _clkCorr->_dotDClk * dtC + _clkCorr->_dotDotDClk * dtC * dtC;
     }
Index: trunk/BNC/src/rinex/corrfile.cpp
===================================================================
--- trunk/BNC/src/rinex/corrfile.cpp	(revision 6553)
+++ trunk/BNC/src/rinex/corrfile.cpp	(revision 6556)
@@ -77,7 +77,8 @@
     }
 
-    int    numEntries;
-    string staID;
-    t_corrSSR::e_type corrType = t_corrSSR::readEpoLine(_lastLine, _lastEpoTime, numEntries, staID);
+    int          numEntries;
+    unsigned int updateInt;
+    string       staID;
+    t_corrSSR::e_type corrType = t_corrSSR::readEpoLine(_lastLine, _lastEpoTime, updateInt, numEntries, staID);
     if      (corrType == t_corrSSR::unknown) {
       throw "t_corrFile: unknown line " + _lastLine;
Index: trunk/BNC/src/satObs.cpp
===================================================================
--- trunk/BNC/src/satObs.cpp	(revision 6553)
+++ trunk/BNC/src/satObs.cpp	(revision 6556)
@@ -30,5 +30,6 @@
     if (!epoTime.valid()) {
       epoTime = corr._time;
-      *out << "> CLOCK " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << "    "
+      *out << "> CLOCK " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
+          <<  corr._updateInt <<  " "
            << corrList.size() << ' ' << corr._staID << endl;
     }
@@ -44,14 +45,16 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_clkCorr::readEpoch(const string& epoLine, istream& inStream, QList<t_clkCorr>& corrList) {
-  bncTime epoTime;
-  int     numCorr;
-  string  staID;
-  if (t_corrSSR::readEpoLine(epoLine, epoTime, numCorr, staID) != t_corrSSR::clkCorr) {
+  bncTime      epoTime;
+  unsigned int updateInt;
+  int          numCorr;
+  string       staID;
+  if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numCorr, staID) != t_corrSSR::clkCorr) {
     return;
   }
   for (int ii = 0; ii < numCorr; ii++) {
     t_clkCorr corr;
-    corr._time  = epoTime;
-    corr._staID = staID;
+    corr._time      = epoTime;
+    corr._updateInt = updateInt;
+    corr._staID     = staID;
 
     string line;
@@ -91,5 +94,6 @@
     if (!epoTime.valid()) {
       epoTime = corr._time;
-      *out << "> ORBIT " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << "    "
+      *out << "> ORBIT " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
+           << corr._updateInt <<  " "
            << corrList.size() << ' ' << corr._staID << endl;
     }
@@ -108,14 +112,16 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_orbCorr::readEpoch(const string& epoLine, istream& inStream, QList<t_orbCorr>& corrList) {
-  bncTime epoTime;
-  int     numCorr;
-  string  staID;
-  if (t_corrSSR::readEpoLine(epoLine, epoTime, numCorr, staID) != t_corrSSR::orbCorr) {
+  bncTime      epoTime;
+  unsigned int updateInt;
+  int          numCorr;
+  string       staID;
+  if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numCorr, staID) != t_corrSSR::orbCorr) {
     return;
   }
   for (int ii = 0; ii < numCorr; ii++) {
     t_orbCorr corr;
-    corr._time  = epoTime;
-    corr._staID = staID;
+    corr._time      = epoTime;
+    corr._updateInt = updateInt;
+    corr._staID     = staID;
 
     string line;
@@ -144,5 +150,6 @@
     if (!epoTime.valid()) {
       epoTime = satCodeBias._time;
-      *out << "> CODE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << "    "
+      *out << "> CODE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
+           << satCodeBias._updateInt <<  " "
            << biasList.size() << ' ' << satCodeBias._staID << endl;
     }
@@ -161,14 +168,16 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_satCodeBias::readEpoch(const string& epoLine, istream& inStream, QList<t_satCodeBias>& biasList) {
-  bncTime epoTime;
-  int     numSat;
-  string  staID;
-  if (t_corrSSR::readEpoLine(epoLine, epoTime, numSat, staID) != t_corrSSR::codeBias) {
+  bncTime      epoTime;
+  unsigned int updateInt;
+  int          numSat;
+  string       staID;
+  if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numSat, staID) != t_corrSSR::codeBias) {
     return;
   }
   for (int ii = 0; ii < numSat; ii++) {
     t_satCodeBias satCodeBias;
-    satCodeBias._time  = epoTime;
-    satCodeBias._staID = staID;
+    satCodeBias._time      = epoTime;
+    satCodeBias._updateInt = updateInt;
+    satCodeBias._staID     = staID;
 
     string line;
@@ -203,5 +212,6 @@
     if (!epoTime.valid()) {
       epoTime = satPhaseBias._time;
-      *out << "> PHASE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << "    "
+      *out << "> PHASE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
+           << satPhaseBias._updateInt <<  " "
            << biasList.size() << ' ' << satPhaseBias._staID << endl;
     }
@@ -225,14 +235,16 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_satPhaseBias::readEpoch(const string& epoLine, istream& inStream, QList<t_satPhaseBias>& biasList) {
-  bncTime epoTime;
-  int     numSat;
-  string  staID;
-  if (t_corrSSR::readEpoLine(epoLine, epoTime, numSat, staID) != t_corrSSR::phaseBias) {
+  bncTime      epoTime;
+  unsigned int updateInt;
+  int          numSat;
+  string       staID;
+  if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numSat, staID) != t_corrSSR::phaseBias) {
     return;
   }
   for (int ii = 0; ii < numSat; ii++) {
     t_satPhaseBias satPhaseBias;
-    satPhaseBias._time  = epoTime;
-    satPhaseBias._staID = staID;
+    satPhaseBias._time      = epoTime;
+    satPhaseBias._updateInt = updateInt;
+    satPhaseBias._staID     = staID;
 
     string line;
@@ -264,5 +276,6 @@
   out->setf(ios::fixed);
   bncTime epoTime = vTec._time;
-  *out << "> VTEC " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << "    "
+  *out << "> VTEC " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
+       << vTec._updateInt <<  " "
        << vTec._layers.size() << ' ' << vTec._staID << endl;
   for (unsigned ii = 0; ii < vTec._layers.size(); ii++) {
@@ -281,8 +294,9 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_vTec::read(const string& epoLine, istream& inStream, t_vTec& vTec) {
-  bncTime epoTime;
-  int     numLayers;
-  string  staID;
-  if (t_corrSSR::readEpoLine(epoLine, epoTime, numLayers, staID) != t_corrSSR::vTec) {
+  bncTime      epoTime;
+  unsigned int updateInt;
+  int          numLayers;
+  string       staID;
+  if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numLayers, staID) != t_corrSSR::vTec) {
     return;
   }
@@ -290,6 +304,7 @@
     return;
   }
-  vTec._time  = epoTime;
-  vTec._staID = staID;
+  vTec._time      = epoTime;
+  vTec._updateInt = updateInt;
+  vTec._staID     = staID;
   for (int ii = 0; ii < numLayers; ii++) {
     t_vTecLayer layer;
@@ -323,5 +338,6 @@
 ////////////////////////////////////////////////////////////////////////////
 t_corrSSR::e_type t_corrSSR::readEpoLine(const string& line, bncTime& epoTime, 
-                                         int& numEntries, string& staID) {
+                                         unsigned int& updateInt, int& numEntries,
+                                         string& staID) {
 
   istringstream inLine(line.c_str());
@@ -333,5 +349,5 @@
 
   inLine >> epoChar >> typeString 
-         >> year >> month >> day >> hour >> min >> sec >> numEntries >> staID;
+         >> year >> month >> day >> hour >> min >> sec >> updateInt >> numEntries >> staID;
 
   if (epoChar == '>') {
Index: trunk/BNC/src/satObs.h
===================================================================
--- trunk/BNC/src/satObs.h	(revision 6553)
+++ trunk/BNC/src/satObs.h	(revision 6556)
@@ -68,4 +68,5 @@
   unsigned short _iod;
   bncTime        _time;
+  unsigned int   _updateInt;
   char           _system;
   ColumnVector   _xr;
@@ -82,4 +83,5 @@
   unsigned short _iod;
   bncTime        _time;
+  unsigned int   _updateInt;
   double         _dClk;
   double         _dotDClk;
@@ -103,4 +105,5 @@
   t_prn                      _prn;
   bncTime                    _time;
+  unsigned int               _updateInt;
   std::vector<t_frqCodeBias> _bias;
 };
@@ -132,4 +135,5 @@
   t_prn                       _prn;
   bncTime                     _time;
+  unsigned int                _updateInt;
   double                      _yawDeg;
   double                      _yawDegRate;
@@ -150,4 +154,5 @@
   std::string              _staID;
   bncTime                  _time;
+  unsigned int            _updateInt;
   std::vector<t_vTecLayer> _layers;
 };
@@ -157,5 +162,5 @@
   enum e_type {clkCorr, orbCorr, codeBias, phaseBias, vTec, unknown};
   static e_type readEpoLine(const std::string& line, bncTime& epoTime,
-                            int& numEntries, std::string& staID);
+                            unsigned int& updateInt, int& numEntries, std::string& staID);
 };
 
