Index: trunk/BNC/RTCM3/ephemeris.h
===================================================================
--- trunk/BNC/RTCM3/ephemeris.h	(revision 2039)
+++ trunk/BNC/RTCM3/ephemeris.h	(revision 2040)
@@ -50,4 +50,5 @@
   t_ephGPS() { }
   ~t_ephGPS() {}
+  double TOC() const {return _TOC;}
 
   void set(const gpsephemeris* ee);
Index: trunk/BNC/bncpppclient.cpp
===================================================================
--- trunk/BNC/bncpppclient.cpp	(revision 2039)
+++ trunk/BNC/bncpppclient.cpp	(revision 2040)
@@ -115,6 +115,14 @@
   QString prn = QString("G%1").arg(gpseph.satellite, 2, 10, QChar('0'));
 
+  cout << "EPH " << prn.toAscii().data() << " " << gpseph.IODE << " " 
+       << gpseph.IODC << endl;
+
   if (_eph.contains(prn)) {
-    (static_cast<t_ephGPS*>(_eph.value(prn)))->set(&gpseph);
+    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 {
@@ -160,5 +168,17 @@
 
   if (_eph.contains(prn)) {
-    _eph.value(prn)->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
+    t_eph* ee = _eph.value(prn);
+    ee->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
+
+    if (_corr.contains(prn)) {
+      t_corr* cc = _corr.value(prn);
+      cout << "found: " << prn.toAscii().data() 
+           << " age: "  << (tt - cc->tt) << " "
+           << ee->IOD() << " " << cc->iod << endl;
+    }
+    else {
+      cout << "not found: " << prn.toAscii().data() << endl;
+    }
+
     return success;
   }
