Index: trunk/BNC/src/PPP_SSR_I/pppClient.cpp
===================================================================
--- trunk/BNC/src/PPP_SSR_I/pppClient.cpp	(revision 8367)
+++ trunk/BNC/src/PPP_SSR_I/pppClient.cpp	(revision 8368)
@@ -353,5 +353,4 @@
 //////////////////////////////////////////////////////////////////////////////
 void t_pppClient::putEphemeris(const t_eph* eph) {
-  bool check = _opt->_realTime;
   if (_newEph)
     delete _newEph;
@@ -375,5 +374,5 @@
 
   if (_newEph) {
-    _ephUser->putNewEph(_newEph, check);
+    _ephUser->putNewEph(_newEph, _opt->_realTime);
   }
 }
Index: trunk/BNC/src/bncephuser.cpp
===================================================================
--- trunk/BNC/src/bncephuser.cpp	(revision 8367)
+++ trunk/BNC/src/bncephuser.cpp	(revision 8368)
@@ -83,5 +83,5 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewGPSEph(t_ephGPS eph) {
-  putNewEph(&eph, false);
+  putNewEph(&eph, true);
 }
 
@@ -89,5 +89,5 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewGlonassEph(t_ephGlo eph) {
-  putNewEph(&eph, false);
+  putNewEph(&eph, true);
 }
 
@@ -95,5 +95,5 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewGalileoEph(t_ephGal eph) {
-  putNewEph(&eph, false);
+  putNewEph(&eph, true);
 }
 
@@ -101,5 +101,5 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewSBASEph(t_ephSBAS eph) {
-  putNewEph(&eph, false);
+  putNewEph(&eph, true);
 }
 
@@ -107,10 +107,10 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewBDSEph(t_ephBDS eph) {
-  putNewEph(&eph, false);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-t_irc bncEphUser::putNewEph(t_eph* eph, bool check) {
+  putNewEph(&eph, true);
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+t_irc bncEphUser::putNewEph(t_eph* eph, bool realTime) {
 
   QMutexLocker locker(&_mutex);
@@ -120,7 +120,5 @@
   }
 
-  if (check) {
-    checkEphemeris(eph);
-  }
+  checkEphemeris(eph, realTime);
 
   const t_ephGPS*     ephGPS     = dynamic_cast<const t_ephGPS*>(eph);
@@ -175,5 +173,5 @@
 //
 ////////////////////////////////////////////////////////////////////////////
-void bncEphUser::checkEphemeris(t_eph* eph) {
+void bncEphUser::checkEphemeris(t_eph* eph, bool realTime) {
 
   if (!eph || eph->checkState() == t_eph::ok || eph->checkState() == t_eph::bad) {
@@ -207,39 +205,39 @@
   // Check whether the epoch is too far away the current time
   // --------------------------------------------------------
-  bncTime   toc = eph->TOC();
-  QDateTime now = currentDateAndTimeGPS();
-  bncTime currentTime(now.toString(Qt::ISODate).toStdString());
-  double timeDiff = fabs(toc - currentTime);
-
-  if      (eph->type() == t_eph::GPS     && timeDiff > 4*3600) { // update interval: 2h, data sets are valid for 4 hours
-    eph->setCheckState(t_eph::outdated);
-    return;
-  }
-  else if (eph->type() == t_eph::Galileo && timeDiff > 4*3600) { // update interval: 2h, data sets are valid for 4 hours
-    eph->setCheckState(t_eph::outdated);
-    return;
-  }
-  else if (eph->type() == t_eph::GLONASS && timeDiff > 1*3600) { // updated every 30 minutes
-    eph->setCheckState(t_eph::outdated);
-    return;
-  }
-  else if (eph->type() == t_eph::QZSS    && timeDiff > 4*3600) { // orbit parameters are valid for 7200 seconds (at minimum)
-    eph->setCheckState(t_eph::outdated);
-    return;
-  }
-  else if (eph->type() == t_eph::SBAS    && timeDiff > 600) { // maximum update interval: 300 sec
-    eph->setCheckState(t_eph::outdated);
-    return;
-  }
-  else if (eph->type() == t_eph::BDS     && timeDiff > 6*3600) { // updates (GEO) up to 6 hours
-    eph->setCheckState(t_eph::outdated);
-    return;
-  }
-  else if (eph->type() == t_eph::IRNSS   && timeDiff > 24*3600) { // update interval: up to 24 hours
-    eph->setCheckState(t_eph::outdated);
-    return;
-  }
-
-
+  if (realTime) {
+    bncTime toc = eph->TOC();
+    QDateTime now = currentDateAndTimeGPS();
+    bncTime currentTime(now.toString(Qt::ISODate).toStdString());
+    double timeDiff = fabs(toc - currentTime);
+
+    if (eph->type() == t_eph::GPS && timeDiff > 4 * 3600) { // update interval: 2h, data sets are valid for 4 hours
+      eph->setCheckState(t_eph::outdated);
+      return;
+    }
+    else if (eph->type() == t_eph::Galileo && timeDiff > 4 * 3600) { // update interval: 2h, data sets are valid for 4 hours
+      eph->setCheckState(t_eph::outdated);
+      return;
+    }
+    else if (eph->type() == t_eph::GLONASS && timeDiff > 1 * 3600) { // updated every 30 minutes
+      eph->setCheckState(t_eph::outdated);
+      return;
+    }
+    else if (eph->type() == t_eph::QZSS && timeDiff > 4 * 3600) { // orbit parameters are valid for 7200 seconds (at minimum)
+      eph->setCheckState(t_eph::outdated);
+      return;
+    }
+    else if (eph->type() == t_eph::SBAS && timeDiff > 600) { // maximum update interval: 300 sec
+      eph->setCheckState(t_eph::outdated);
+      return;
+    }
+    else if (eph->type() == t_eph::BDS && timeDiff > 6 * 3600) { // updates (GEO) up to 6 hours
+      eph->setCheckState(t_eph::outdated);
+      return;
+    }
+    else if (eph->type() == t_eph::IRNSS && timeDiff > 24 * 3600) { // update interval: up to 24 hours
+      eph->setCheckState(t_eph::outdated);
+      return;
+    }
+  }
 
   // Check consistency with older ephemerides
Index: trunk/BNC/src/bncephuser.h
===================================================================
--- trunk/BNC/src/bncephuser.h	(revision 8367)
+++ trunk/BNC/src/bncephuser.h	(revision 8368)
@@ -74,5 +74,5 @@
 
  private:
-  void checkEphemeris(t_eph* eph);
+  void checkEphemeris(t_eph* eph, bool realTime);
   QMutex                             _mutex;
   static const unsigned              _maxQueueSize = 5;
Index: trunk/BNC/src/ephemeris.cpp
===================================================================
--- trunk/BNC/src/ephemeris.cpp	(revision 8367)
+++ trunk/BNC/src/ephemeris.cpp	(revision 8368)
@@ -335,8 +335,13 @@
   double E  = M;
   double E_last;
+  int    nLoop = 0;
   do {
     E_last = E;
     E = M + _e*sin(E);
-  } while ( fabs(E-E_last)*a0 > 0.001 );
+
+    if (++nLoop == 100) {
+      return failure;
+    }
+  } while ( fabs(E-E_last)*a0 > 0.001);
   double v      = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) );
   double u0     = v + _omega;
@@ -922,7 +927,12 @@
   double E  = M;
   double E_last;
+  int    nLoop = 0;
   do {
     E_last = E;
     E = M + _e*sin(E);
+
+    if (++nLoop == 100) {
+      return failure;
+    }
   } while ( fabs(E-E_last)*a0 > 0.001 );
   double v      = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) );
@@ -1507,4 +1517,6 @@
 
   return CRC24(size, startbuffer);
+
+
 }
 
Index: trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 8367)
+++ trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 8368)
@@ -1054,5 +1054,5 @@
     for (unsigned ii = 0; ii < rnxNavFile.ephs().size(); ii++) {
       t_eph* eph = rnxNavFile.ephs()[ii];
-      ephUser.putNewEph(eph, true);
+      ephUser.putNewEph(eph, false);
       if (eph->checkState() == t_eph::bad) {
         ++numBad;
Index: trunk/BNC/src/rinex/reqcedit.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcedit.cpp	(revision 8367)
+++ trunk/BNC/src/rinex/reqcedit.cpp	(revision 8368)
@@ -642,4 +642,7 @@
       break;
     }
+    if (eph->checkState() != t_eph::bad) {
+      continue;
+    }
     outNavFile.writeEph(eph);
   }
Index: trunk/BNC/src/rinex/rnxnavfile.cpp
===================================================================
--- trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 8367)
+++ trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 8368)
@@ -210,12 +210,5 @@
       eph = new t_ephGPS(version(), lines);
     }
-    if (eph &&
-        eph->checkState() != t_eph::bad &&
-        eph->checkState() != t_eph::outdated) {
-      _ephs.push_back(eph);
-    }
-    else {
-      delete eph;
-    }
+    _ephs.push_back(eph);
   }
 }
