Index: trunk/BNC/src/GPSDecoder.cpp
===================================================================
--- trunk/BNC/src/GPSDecoder.cpp	(revision 8369)
+++ trunk/BNC/src/GPSDecoder.cpp	(revision 8372)
@@ -35,5 +35,5 @@
  * Created:    16-Dec-2011
  *
- * Changes:    
+ * Changes:
  *
  * -----------------------------------------------------------------------*/
@@ -45,4 +45,5 @@
 #include "bncsettings.h"
 #include "bncrinex.h"
+#include "bncutils.h"
 
 using namespace std;
@@ -63,5 +64,5 @@
 //////////////////////////////////////////////////////////////////////////////
 void GPSDecoder::initRinex(const QByteArray& staID, const QUrl& mountPoint,
-                           const QByteArray& latitude, 
+                           const QByteArray& latitude,
                            const QByteArray& longitude, const QByteArray& nmea,
                            const QByteArray& ntripVersion) {
@@ -70,9 +71,9 @@
   }
   bncSettings settings;
-  if ( !settings.value("rnxPath").toString().isEmpty() ) { 
-    _rnx = new bncRinex(staID, mountPoint, latitude, longitude, 
+  if ( !settings.value("rnxPath").toString().isEmpty() ) {
+    _rnx = new bncRinex(staID, mountPoint, latitude, longitude,
                         nmea, ntripVersion);
   }
-} 
+}
 
 // Write RINEX Epoch
@@ -80,11 +81,11 @@
 void GPSDecoder::dumpRinexEpoch(const t_satObs& obs, const QByteArray& format) {
   if (_rnx) {
-    long iSec    = long(floor(obs._time.gpssec()+0.5));
-    if (_rnx->samplingRate() == 0 || iSec % _rnx->samplingRate() == 0) {
+    int sec = int(nint(obs._time.gpssec()*10));
+    if (_rnx->samplingRate() == 0 || sec % (_rnx->samplingRate()*10) == 0) {
       _rnx->deepCopy(obs);
     }
     _rnx->dumpEpoch(format, obs._time);
   }
-} 
+}
 
 // Set RINEX Reconnect Flag
Index: trunk/BNC/src/bnccaster.cpp
===================================================================
--- trunk/BNC/src/bnccaster.cpp	(revision 8369)
+++ trunk/BNC/src/bnccaster.cpp	(revision 8372)
@@ -303,7 +303,6 @@
     if (epoTime <= maxTime) {
       const QList<t_satObs>& allObs = itEpo.value();
-      int sec = int(nint(epoTime.gpssec()));
-      if ( (_out || _sockets) && (_samplingRate == 0 || sec % _samplingRate == 0) ) {
-
+      int sec = int(nint(epoTime.gpssec()*10));
+      if ( (_out || _sockets) && (_samplingRate == 0 || sec % (_samplingRate*10) == 0) ) {
         QListIterator<t_satObs> it(allObs);
         bool firstObs = true;
Index: trunk/BNC/src/bnctime.cpp
===================================================================
--- trunk/BNC/src/bnctime.cpp	(revision 8369)
+++ trunk/BNC/src/bnctime.cpp	(revision 8372)
@@ -17,5 +17,5 @@
   this->set(gpsw, gpssec);
 }
-  
+
 // Constructor (from ISO String yyyy-mm-ddThh:mm:ss)
 //////////////////////////////////////////////////////////////////////////////
@@ -24,5 +24,5 @@
     QDateTime dt = QDateTime::fromString(isoString.c_str(), Qt::ISODate);
     this->set(dt.date().year(), dt.date().month(), dt.date().day(),
-              dt.time().hour(), dt.time().minute(), 
+              dt.time().hour(), dt.time().minute(),
               dt.time().second() + dt.time().msec()/1000.0);
   }
@@ -32,15 +32,15 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime& bncTime::set(int gpsw, double gpssec) {
   int  deltad;
   int  dow = 0;
-  while ( gpssec >= 86400 ) {
-    gpssec-=86400;
+  while ( gpssec >= 86400.0 ) {
+    gpssec-=86400.0;
     dow++;
   }
-  while ( gpssec <  0 ) {
-    gpssec+=86400;
+  while ( gpssec <  0.0 ) {
+    gpssec+=86400.0;
     dow--;
   }
@@ -59,10 +59,10 @@
   gpssec += 14.0;
   gpsw   += 1356.0;
-  while ( gpssec >= 86400 ) {
-    gpssec-=86400;
+  while ( gpssec >= 86400.0 ) {
+    gpssec-=86400.0;
     dow++;
   }
-  while ( gpssec <  0 ) {
-    gpssec+=86400;
+  while ( gpssec <  0.0 ) {
+    gpssec+=86400.0;
     dow--;
   }
@@ -73,5 +73,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime &bncTime::set(int msec) {
@@ -85,5 +85,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime &bncTime::setTOD(int msec) {
@@ -108,5 +108,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime &bncTime::setTk(int msec) {
@@ -122,5 +122,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime &bncTime::setBDS(int msec) {
@@ -137,15 +137,15 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime& bncTime::setmjd(double daysec, int mjd) {
   _sec = daysec;
   _mjd = mjd;
-  while ( _sec >= 86400 ) {
-    _sec-=86400;
+  while ( _sec >= 86400.0 ) {
+    _sec-=86400.0;
     _mjd++;
   }
-  while ( _sec <  0 ) {
-    _sec+=86400;
+  while ( _sec <  0.0 ) {
+    _sec+=86400.0;
     _mjd--;
   }
@@ -153,5 +153,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime& bncTime::setmjd(double mjddec) {
@@ -161,10 +161,10 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 unsigned int bncTime::mjd() const {
   return _mjd;
 }
- 
+
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -182,5 +182,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 double bncTime::gpssec() const {
@@ -202,5 +202,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 double bncTime::bdssec() const {
@@ -215,5 +215,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bool bncTime::operator!=(const bncTime &time1) const {
@@ -226,5 +226,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bool bncTime::operator==(const bncTime &time1) const {
@@ -237,5 +237,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bool bncTime::operator>(const bncTime &time1) const {
@@ -248,5 +248,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bool bncTime::operator>=(const bncTime &time1) const {
@@ -259,5 +259,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bool bncTime::operator<(const bncTime &time1) const {
@@ -270,5 +270,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bool bncTime::operator<=(const bncTime &time1) const {
@@ -281,5 +281,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime bncTime::operator+(double sec) const {
@@ -290,5 +290,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime bncTime::operator-(double sec) const {
@@ -296,5 +296,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 double bncTime::operator-(const bncTime &time1) const {
@@ -323,5 +323,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 void bncTime::civil_date (unsigned int& year, unsigned int& month,
@@ -335,7 +335,7 @@
 }
 
-// 
-//////////////////////////////////////////////////////////////////////////////
-void bncTime::civil_time(unsigned int &hour, unsigned int &min, 
+//
+//////////////////////////////////////////////////////////////////////////////
+void bncTime::civil_time(unsigned int &hour, unsigned int &min,
                           double &sec) const {
   hour = static_cast<unsigned int>(_sec/3600.0);
@@ -352,5 +352,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 string bncTime::timestr(unsigned numdec, char sep) const {
@@ -386,5 +386,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 string bncTime::datestr(char sep) const {
@@ -402,5 +402,5 @@
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime::operator std::string() const {
@@ -408,25 +408,25 @@
 }
 
-// 
-//////////////////////////////////////////////////////////////////////////////
-bncTime& bncTime::set(int year, int month, int day, 
+//
+//////////////////////////////////////////////////////////////////////////////
+bncTime& bncTime::set(int year, int month, int day,
                       int hour, int min, double sec) {
   return set(year, month, day, hour*3600 + min*60 + sec);
 }
 
-// 
-//////////////////////////////////////////////////////////////////////////////
-bncTime& bncTime::setBDS(int year, int month, int day, 
+//
+//////////////////////////////////////////////////////////////////////////////
+bncTime& bncTime::setBDS(int year, int month, int day,
                       int hour, int min, double sec) {
   return set(year, month, day, hour*3600 + min*60 + sec+14.0);
 }
 
-// 
+//
 //////////////////////////////////////////////////////////////////////////////
 bncTime& bncTime::set(int year, int month, int day, double daysec) {
   _sec = daysec;
-  
+
   _mjd = (unsigned int)djul(year, month, day);
-  
+
   while ( _sec >= 86400 ) {
     _sec-=86400;
Index: trunk/BNC/src/latencychecker.cpp
===================================================================
--- trunk/BNC/src/latencychecker.cpp	(revision 8369)
+++ trunk/BNC/src/latencychecker.cpp	(revision 8372)
@@ -327,7 +327,7 @@
       const t_satObs& obs = it.next();
       bool wrongObservationEpoch = checkForWrongObsEpoch(obs._time);
-      l._newSec = static_cast<int>(obs._time.gpssec());
+      l._newSec = static_cast<int>(nint(obs._time.gpssec()*10));
       if (l._newSec > l._oldSec && !wrongObservationEpoch) {
-        if (l._newSec % _miscIntr < l._oldSec % _miscIntr) {
+        if (l._newSec % _miscIntr < l._oldSec % (_miscIntr * 10)) {
           if (l._numLat > 0) {
             if (l._meanDiff > 0.0) {
Index: trunk/BNC/src/rinex/reqcedit.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcedit.cpp	(revision 8369)
+++ trunk/BNC/src/rinex/reqcedit.cpp	(revision 8372)
@@ -337,6 +337,6 @@
         }
 
-        if (_samplingRate == 0 ||
-            fmod(round(epo->tt.gpssec()), _samplingRate) == 0) {
+        int sec = int(nint(epo->tt.gpssec()*10));
+        if (_samplingRate == 0 || sec % (_samplingRate*10) == 0) {
           applyLLI(obsFile, epo);
           outObsFile.writeEpoch(epo);
