Index: trunk/BNC/src/upload/bncephuploadcaster.cpp
===================================================================
--- trunk/BNC/src/upload/bncephuploadcaster.cpp	(revision 7666)
+++ trunk/BNC/src/upload/bncephuploadcaster.cpp	(revision 7716)
@@ -11,5 +11,5 @@
  * Created:    03-Apr-2011
  *
- * Changes:    
+ * Changes:
  *
  * -----------------------------------------------------------------------*/
@@ -17,5 +17,5 @@
 #include <iostream>
 #include <math.h>
-#include "bncephuploadcaster.h" 
+#include "bncephuploadcaster.h"
 #include "bncsettings.h"
 #include "RTCM3/ephEncoder.h"
@@ -38,8 +38,8 @@
     int     sampl    = settings.value("uploadEphSample").toInt();
 
-    _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort, 
+    _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort,
                                            password, -1, sampl);
 
-    connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)), 
+    connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)),
           this, SIGNAL(newBytes(QByteArray,double)));
 
@@ -62,7 +62,13 @@
     QByteArray outBuffer;
 
+    QDateTime now = currentDateAndTimeGPS();
+    bncTime currentTime(now.toString(Qt::ISODate).toStdString());
+
     QListIterator<QString> it(prnList());
     while (it.hasNext()) {
       const t_eph* eph = ephLast(it.next());
+
+      bncTime toc = eph->TOC();
+      double timeDiff = fabs(toc - currentTime);
 
       const t_ephGPS*  ephGPS  = dynamic_cast<const t_ephGPS*>(eph);
@@ -76,17 +82,27 @@
 
       if (ephGPS) {
-        size = t_ephEncoder::RTCM3(*ephGPS, Array);
+        if (eph->checkState() == t_eph::ok && timeDiff <= 4*3600) {
+          size = t_ephEncoder::RTCM3(*ephGPS, Array);
+        }
       }
       else if (ephGlo) {
-        size = t_ephEncoder::RTCM3(*ephGlo, Array);
+        if (eph->checkState() == t_eph::ok && timeDiff <= 1*3600) {
+          size = t_ephEncoder::RTCM3(*ephGlo, Array);
+        }
       }
       else if (ephGal) {
-        size = t_ephEncoder::RTCM3(*ephGal, Array);
+        if (eph->checkState() == t_eph::ok && timeDiff <= 4*3600) {
+          size = t_ephEncoder::RTCM3(*ephGal, Array);
+        }
       }
       else if (ephSBAS) {
-        size = t_ephEncoder::RTCM3(*ephSBAS, Array);
+        if (eph->checkState() == t_eph::ok && timeDiff <= 600) {
+          size = t_ephEncoder::RTCM3(*ephSBAS, Array);
+        }
       }
       else if (ephBDS) {
-        size = t_ephEncoder::RTCM3(*ephBDS, Array);
+        if (eph->checkState() == t_eph::ok && timeDiff <= 6*3600) {
+          size = t_ephEncoder::RTCM3(*ephBDS, Array);
+        }
       }
       if (size > 0) {
