Index: trunk/BNS/bnsoutf.cpp
===================================================================
--- trunk/BNS/bnsoutf.cpp	(revision 851)
+++ trunk/BNS/bnsoutf.cpp	(revision 852)
@@ -38,4 +38,7 @@
     _path += QDir::separator();
   }
+
+  _lastGPSweek  = 0;
+  _lastGPSweeks = 0.0;
 }
 
Index: trunk/BNS/bnsoutf.h
===================================================================
--- trunk/BNS/bnsoutf.h	(revision 851)
+++ trunk/BNS/bnsoutf.h	(revision 852)
@@ -18,4 +18,6 @@
   virtual void writeHeader(const QDateTime& datTim) = 0;
   std::ofstream _out;
+  int           _lastGPSweek;
+  double        _lastGPSweeks;
 
  private:
Index: trunk/BNS/bnssp3.cpp
===================================================================
--- trunk/BNS/bnssp3.cpp	(revision 851)
+++ trunk/BNS/bnssp3.cpp	(revision 852)
@@ -17,4 +17,5 @@
 
 #include <iomanip>
+#include <math.h>
 
 #include "bnssp3.h"
@@ -38,5 +39,5 @@
 ////////////////////////////////////////////////////////////////////////////
 void bnsSP3::writeHeader(const QDateTime& datTim) {
-  _out << "THIS IS A DUMMY HEADER" << endl;
+  _out << "THIS IS A DUMMY SP3 HEADER" << endl;
 }
 
@@ -48,17 +49,19 @@
   bnsoutf::write(GPSweek, GPSweeks, prn, xx);
 
-  int year, month, day, hour, min;
-  double sec;
+  if (_lastGPSweek != GPSweek || _lastGPSweeks != GPSweeks) {
+    _lastGPSweek  = GPSweek;
+    _lastGPSweeks = GPSweeks;
 
-  _out << "*  " << setw(4) << year 
-       << setw(3) << month 
-       << setw(3) << day
-       << setw(3) << hour 
-       << setw(3) << min
-       << setw(12) << setprecision(8) << sec << endl; 
+    QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
+    double sec = fmod(GPSweeks, 60.0);
+
+    _out << "*  " 
+         << datTim.toString("yyyy MM dd hh mm").toAscii().data()
+         << setw(12) << setprecision(8) << sec << endl; 
+  }
   _out << "P" << prn.toAscii().data()
        << setw(14) << setprecision(6) << xx(1) / 1000.0
        << setw(14) << setprecision(6) << xx(2) / 1000.0
        << setw(14) << setprecision(6) << xx(3) / 1000.0
-       << " 999999.999999" << endl;
+       << setw(14) << setprecision(6) << xx(4) * 1e6 << endl;
 }
