Index: trunk/BNC/RTCM3/ephemeris.cpp
===================================================================
--- trunk/BNC/RTCM3/ephemeris.cpp	(revision 2233)
+++ trunk/BNC/RTCM3/ephemeris.cpp	(revision 2234)
@@ -1,6 +1,9 @@
 #include <math.h>
 #include <sstream>
+#include <iostream>
 #include <iomanip>
 #include <cstring>
+
+#include <newmatio.h>
 
 #include "ephemeris.h"
@@ -251,7 +254,16 @@
   _prn = prn.str();
 
-  _GPSweek  = ee->GPSWeek;
-  _GPSweeks = ee->GPSTOW;
-
+  int ww  = ee->GPSWeek;
+  int tow = ee->GPSTOW; 
+
+  updatetime(&ww, &tow, ee->tb*1000, 1);
+
+  int tk = ee->tk-3*60*60; 
+  if (tk < 0) {
+    tk += 86400;
+  }
+
+  _GPSweek           = ww;
+  _GPSweeks          = tow;
   _gps_utc           = 0.0;
   _E                 = ee->E;
@@ -269,5 +281,5 @@
   _health            = 0;
   _frequency_number  = ee->frequency_number;
-  _tki               = ee->tk;
+  _tki               = tk;
 
   // Initialize status vector
@@ -281,3 +293,7 @@
   _xv(5) = _y_velocity * 1.e3; 
   _xv(6) = _z_velocity * 1.e3; 
-}
+
+  cout << _prn << " " << _GPSweek << " " << _GPSweeks << " " 
+       << _tki << " "  << _xv << endl;
+
+}
