Index: /trunk/BNC/src/RTCM3/ephemeris.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/ephemeris.cpp	(revision 5132)
+++ /trunk/BNC/src/RTCM3/ephemeris.cpp	(revision 5133)
@@ -375,5 +375,5 @@
 // Set Glonass Ephemeris
 ////////////////////////////////////////////////////////////////////////////
-void t_ephGlo::set(const glonassephemeris* ee, bool& timeChanged) {
+void t_ephGlo::set(const glonassephemeris* ee) {
 
   _receptDateTime = currentDateAndTimeGPS();
@@ -387,5 +387,5 @@
   // Check the day once more 
   // -----------------------
-  timeChanged = false;
+  bool timeChanged = false;
   {
     const double secPerDay  = 24 * 3600.0;
Index: /trunk/BNC/src/RTCM3/ephemeris.h
===================================================================
--- /trunk/BNC/src/RTCM3/ephemeris.h	(revision 5132)
+++ /trunk/BNC/src/RTCM3/ephemeris.h	(revision 5133)
@@ -141,5 +141,5 @@
   virtual int  RTCM3(unsigned char *);
 
-  void set(const glonassephemeris* ee, bool& timeChanged);
+  void set(const glonassephemeris* ee);
 
   int  slotNum() const {return int(_frequency_number);}
Index: /trunk/BNC/src/bnccore.cpp
===================================================================
--- /trunk/BNC/src/bnccore.cpp	(revision 5132)
+++ /trunk/BNC/src/bnccore.cpp	(revision 5133)
@@ -518,6 +518,5 @@
 
   t_ephGlo eph;
-  bool timeChanged;
-  eph.set(ep, timeChanged);
+  eph.set(ep);
 
   QString strV2 = eph.toString(2.11);
Index: /trunk/BNC/src/bncephuser.cpp
===================================================================
--- /trunk/BNC/src/bncephuser.cpp	(revision 5132)
+++ /trunk/BNC/src/bncephuser.cpp	(revision 5133)
@@ -77,22 +77,24 @@
   QMutexLocker locker(&_mutex);
 
-  QString prn = QString("G%1").arg(gpseph.satellite, 2, 10, QChar('0'));
+  t_ephGPS* eNew = new t_ephGPS(); eNew->set(&gpseph);
+
+  const QString& prn = eNew->prn();
 
   if (_eph.contains(prn)) {
     t_ephGPS* eLast = static_cast<t_ephGPS*>(_eph.value(prn)->last);
-    bncTime toc(gpseph.GPSweek, gpseph.TOC);
-    if (eLast->TOC() < toc) {
-      delete static_cast<t_ephGPS*>(_eph.value(prn)->prev);
+    if (eNew->isNewerThan(eLast)) {
+      delete _eph.value(prn)->prev;
       _eph.value(prn)->prev = _eph.value(prn)->last;
-      _eph.value(prn)->last = new t_ephGPS();
-      static_cast<t_ephGPS*>(_eph.value(prn)->last)->set(&gpseph);
+      _eph.value(prn)->last = eNew;
+      ephBufferChanged();
+    }
+    else {
+      delete eNew;
     }
   }
   else {
-    t_ephGPS* eLast = new t_ephGPS();
-    eLast->set(&gpseph);
-    _eph.insert(prn, new t_ephPair(eLast));
-  }
-  ephBufferChanged();
+    _eph.insert(prn, new t_ephPair(eNew));
+    ephBufferChanged();
+  }
 }
 
@@ -102,38 +104,24 @@
   QMutexLocker locker(&_mutex);
 
-  QString prn = QString("R%1").arg(gloeph.almanac_number, 2, 10, QChar('0'));
+  t_ephGlo* eNew = new t_ephGlo(); eNew->set(&gloeph);
+
+  const QString& prn = eNew->prn();
 
   if (_eph.contains(prn)) {
-    int ww  = gloeph.GPSWeek;
-    int tow = gloeph.GPSTOW; 
-    updatetime(&ww, &tow, gloeph.tb*1000, 0);  // Moscow -> GPS
     t_ephGlo* eLast = static_cast<t_ephGlo*>(_eph.value(prn)->last);
-    bncTime toc(ww, tow);
-    if (eLast->TOC() < toc) {
-      t_ephGlo* ephGlo = new t_ephGlo();
-      bool timeChanged;
-      ephGlo->set(&gloeph, timeChanged);
-      if (timeChanged) {
-        delete ephGlo;
-      }
-      else {
-        delete static_cast<t_ephGlo*>(_eph.value(prn)->prev);
-        _eph.value(prn)->prev = _eph.value(prn)->last;
-        _eph.value(prn)->last = ephGlo;
-      }
+    if (eNew->isNewerThan(eLast)) {
+      delete _eph.value(prn)->prev;
+      _eph.value(prn)->prev = _eph.value(prn)->last;
+      _eph.value(prn)->last = eNew;
+      ephBufferChanged();
+    }
+    else {
+      delete eNew;
     }
   }
   else {
-    t_ephGlo* eLast = new t_ephGlo();
-    bool timeChanged;
-    eLast->set(&gloeph, timeChanged);
-    if (timeChanged) {
-      delete eLast;
-    }
-    else {
-      _eph.insert(prn, new t_ephPair(eLast));
-    }
-  }
-  ephBufferChanged();
+    _eph.insert(prn, new t_ephPair(eNew));
+    ephBufferChanged();
+  }
 }
 
