Index: trunk/BNC/src/bncclockrinex.cpp
===================================================================
--- trunk/BNC/src/bncclockrinex.cpp	(revision 10613)
+++ trunk/BNC/src/bncclockrinex.cpp	(revision 11179)
@@ -36,4 +36,7 @@
 ////////////////////////////////////////////////////////////////////////////
 bncClockRinex::~bncClockRinex() {
+  if (_lastEpoTime.valid()) {
+    writeEpoch(_lastEpoTime, _oStr.str()); // last epoch, otherwise printed with the next one
+  }
   bncoutf::closeFile();
 }
@@ -47,5 +50,5 @@
   _oStr.setf(ios::fixed);
 
-  if (reopen(GPSweek, GPSweeks) == success) {
+  if (_sampl == 0 || fmod(GPSweeks, _sampl) == 0.0) {
 
     bncTime epoTime(GPSweek, GPSweeks);
@@ -53,10 +56,8 @@
     if (epoTime != _lastEpoTime) {
 
-      // print out epoch before
+      // print out epoch before (complete now)
       if (_lastEpoTime.valid()) {
-        _out << _oStr.str();
-        if (_lastEpoTime.daysec() != 0.0) {
-          _oStr.str(std::string());
-        }
+        writeEpoch(_lastEpoTime, _oStr.str());
+        _oStr.str(std::string());
       }
 
