Index: /trunk/BNC/bncpppclient.cpp
===================================================================
--- /trunk/BNC/bncpppclient.cpp	(revision 2574)
+++ /trunk/BNC/bncpppclient.cpp	(revision 2575)
@@ -103,5 +103,5 @@
   delete _model;
   delete _epoData;
-  QMapIterator<QString, t_eph*> it(_eph);
+  QMapIterator<QString, t_ephPair*> it(_eph);
   while (it.hasNext()) {
     it.next();
@@ -250,15 +250,19 @@
 
   if (_eph.contains(prn)) {
-    t_ephGPS* ee = static_cast<t_ephGPS*>(_eph.value(prn));
-    if ( (ee->GPSweek() <  gpseph.GPSweek) || 
-         (ee->GPSweek() == gpseph.GPSweek &&  
-          ee->TOC()     <  gpseph.TOC) ) {  
-      ee->set(&gpseph);
-    }
-  }
-  else {
-    t_ephGPS* ee = new t_ephGPS();
-    ee->set(&gpseph);
-    _eph[prn] = ee;
+    t_ephGPS* eLast = static_cast<t_ephGPS*>(_eph.value(prn)->last);
+    t_ephGPS* ePrev = static_cast<t_ephGPS*>(_eph.value(prn)->prev);
+    if ( (eLast->GPSweek() <  gpseph.GPSweek) || 
+         (eLast->GPSweek() == gpseph.GPSweek &&  
+          eLast->TOC()     <  gpseph.TOC) ) {
+      delete ePrev;
+      ePrev = new t_ephGPS(*eLast);  
+      eLast->set(&gpseph);
+    }
+  }
+  else {
+    t_ephGPS* eLast = new t_ephGPS();
+    eLast->set(&gpseph);
+    _eph.insert(prn, new t_ephPair());
+    _eph[prn]->last = eLast;
   }
 }
@@ -275,14 +279,18 @@
     int tow = gloeph.GPSTOW; 
     updatetime(&ww, &tow, gloeph.tb*1000, 0);  // Moscow -> GPS
-    t_ephGlo* ee = static_cast<t_ephGlo*>(_eph.value(prn));
-    if (ee->GPSweek() < ww || 
-        (ee->GPSweek()  == ww &&  ee->GPSweeks() <  tow)) {  
-      ee->set(&gloeph);
-    }
-  }
-  else {
-    t_ephGlo* ee = new t_ephGlo();
-    ee->set(&gloeph);
-    _eph[prn] = ee;
+    t_ephGlo* eLast = static_cast<t_ephGlo*>(_eph.value(prn)->last);
+    t_ephGlo* ePrev = static_cast<t_ephGlo*>(_eph.value(prn)->prev);
+    if (eLast->GPSweek() < ww || 
+        (eLast->GPSweek()  == ww &&  eLast->GPSweeks() <  tow)) {  
+      delete ePrev;
+      ePrev = new t_ephGlo(*eLast);  
+      eLast->set(&gloeph);
+    }
+  }
+  else {
+    t_ephGlo* eLast = new t_ephGlo();
+    eLast->set(&gloeph);
+    _eph.insert(prn, new t_ephPair());
+    _eph[prn]->last = eLast;
   }
 }
@@ -426,5 +434,5 @@
 
   if (_eph.contains(prn)) {
-    t_eph* ee = _eph.value(prn);
+    t_eph* ee = _eph.value(prn)->last;
     ee->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
 
@@ -432,5 +440,5 @@
       if (_corr.contains(prn)) {
         t_corr* cc = _corr.value(prn);
-        if (ee->IOD() == cc->iod && (tt - cc->tt) < MAXAGE) {
+	if (ee->IOD() == cc->iod && (tt - cc->tt) < MAXAGE) {
           applyCorr(tt, cc, xc, vv);
           return success;
Index: /trunk/BNC/bncpppclient.h
===================================================================
--- /trunk/BNC/bncpppclient.h	(revision 2574)
+++ /trunk/BNC/bncpppclient.h	(revision 2575)
@@ -143,4 +143,18 @@
   };
 
+  class t_ephPair {
+   public:
+    t_ephPair() {
+      last = 0;
+      prev = 0;
+    }
+    ~t_ephPair() {
+      delete last;
+      delete prev;
+    }
+    t_eph* last;
+    t_eph* prev;
+  };
+
   t_irc getSatPos(const bncTime& tt, const QString& prn, 
                   ColumnVector& xc, ColumnVector& vv);
@@ -152,5 +166,5 @@
   QByteArray              _staID;
   QMutex                  _mutex;
-  QMap<QString, t_eph*>   _eph;
+  QMap<QString, t_ephPair*> _eph;
   QMap<QString, t_corr*>  _corr;
   QMap<QString, t_bias*>  _bias;
