Index: trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/src/combination/bnccomb.cpp	(revision 11218)
+++ trunk/BNC/src/combination/bnccomb.cpp	(revision 11220)
@@ -47,4 +47,10 @@
 const double CLK_LEVEL_TAU    = 3600.0; // [s] relaxation of the sum to zero
 const double CLK_LEVEL_MAXGAP =   60.0; // [s] longer gap: sum set to zero again
+
+// Real-time input: corrections whose epoch differs more than this from the
+// current time are not used (bogus epochs, e.g. a GLONASS epoch encoded hours
+// ahead); clocks are limited to CLK_MAX_EPOCH_OFFSET anyway
+const double MAX_EPOCH_OFFSET     = 900.0; // [s]
+const double CLK_MAX_EPOCH_OFFSET =  60.0; // [s]
 
 using namespace std;
@@ -471,4 +477,7 @@
       continue;
     }
+    if (epochOutOfRange(acName, orbCorr._time, MAX_EPOCH_OFFSET, "orbit")) {
+      continue;
+    }
 
     // Store the correction; the latest orbit of the previous IOD is kept as
@@ -514,4 +523,7 @@
       continue;
     }
+    if (epochOutOfRange(acName, satCodeBias._time, MAX_EPOCH_OFFSET, "code bias", true)) {
+      continue;
+    }
 
     // Store the correction
@@ -553,4 +565,7 @@
       continue;
     }
+    if (epochOutOfRange(acName, satPhaseBias._time, MAX_EPOCH_OFFSET, "phase bias", true)) {
+      continue;
+    }
 
     // Store the correction
@@ -562,4 +577,48 @@
 }
 
+
+// Real-time input: true if the correction epoch differs more than maxOffset
+// from the current time (not used; replay of a raw file: more than
+// MAX_EPOCH_OFFSET); pastOk: biases, whose epoch may legitimately be hours
+// old (Galileo HAS: reference time of quasi-static biases), only future
+// epochs are rejected; a warning at most once per hour and AC
+// for offsets beyond MAX_EPOCH_OFFSET (bogus epochs, not just the backlog of
+// a stream after a (re)connect)
+////////////////////////////////////////////////////////////////////////////
+bool bncComb::epochOutOfRange(const QString& acName, const bncTime& epoTime,
+                              double maxOffset, const char* type, bool pastOk) {
+  // replay of a raw file (batch): only bogus epochs, the current time is
+  // that of the replayed chunk
+  if (BNC_CORE->mode() == t_bncCore::batchPostProcessing) {
+    if (!BNC_CORE->dateAndTimeGPSSet()) {
+      return false;
+    }
+    maxOffset = max(maxOffset, MAX_EPOCH_OFFSET);
+  }
+  int    currentWeek = 0;
+  double currentSec  = 0.0;
+  currentGPSWeeks(currentWeek, currentSec);
+  bncTime currentTime(currentWeek, currentSec);
+  double offset = epoTime - currentTime;
+  if (fabs(offset) <= maxOffset || (pastOk && offset < 0.0)) {
+    return false;
+  }
+  if (fabs(offset) > MAX_EPOCH_OFFSET) {
+    bncTime& warned = _badEpochWarned[acName];
+    if (!warned.valid() || currentTime - warned >= 3600.0) {
+      warned = currentTime;
+      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + acName.toLatin1() + " " + type +
+                      " correction epoch " + QByteArray(epoTime.datestr().c_str()) + " " + epoTime.timestr().c_str() +
+                      QString(" is %1 s from the current time, not used").arg(offset, 0, 'f', 0).toLatin1() +
+                      " (further ones of this AC not reported within the next hour)"), true);
+    }
+  }
+#ifdef BNC_DEBUG_CMB
+  emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: future or very old data sets: " + acName.toLatin1() + " " + type +
+      QString(" %1 ").arg(epoTime.timestr().c_str()).toLatin1() + "vs. current time" +
+      QString(" %1 ").arg(currentTime.timestr().c_str()).toLatin1()), true);
+#endif
+  return true;
+}
 
 // True if every AC has delivered clock corrections for epoTime or a later
@@ -598,17 +657,28 @@
     }
 
+    // Check regarding current time (before the epoch is remembered: a bogus
+    // future epoch would mark the AC as delivered for hours, the combination
+    // would no longer wait for it)
+    // ----------------------------
+    QString acOfClk;
+    QListIterator<cmbAC*> itClkAC(_ACs);
+    while (itClkAC.hasNext()) {
+      cmbAC* AC = itClkAC.next();
+      if (AC->mountPoint == QString(newClk._staID.c_str())) {
+        acOfClk = AC->name;
+        break;
+      }
+    }
+    if (acOfClk.isEmpty() ||
+        epochOutOfRange(acOfClk, newClk._time, CLK_MAX_EPOCH_OFFSET, "clock")) { // future or very old data sets
+      continue;
+    }
+
     // Remember the latest correction epoch of each AC (whether or not the
     // correction is used), to know when an AC has finished an epoch
     // --------------------------------------------------------------------
-    QListIterator<cmbAC*> itAC(_ACs);
-    while (itAC.hasNext()) {
-      cmbAC* AC = itAC.next();
-      if (AC->mountPoint == QString(newClk._staID.c_str())) {
-        bncTime& acLast = _acLastClkTime[AC->name];
-        if (!acLast.valid() || newClk._time > acLast) {
-          acLast = newClk._time;
-        }
-        break;
-      }
+    bncTime& acLast = _acLastClkTime[acOfClk];
+    if (!acLast.valid() || newClk._time > acLast) {
+      acLast = newClk._time;
     }
 
@@ -649,17 +719,4 @@
       }
       continue;
-    }
-
-    // Check regarding current time
-    // ----------------------------
-    if (BNC_CORE->mode() != t_bncCore::batchPostProcessing) {
-      if (fabs(currentTime - newClk._time) > 60.0) { // future or very old data sets
-  #ifdef BNC_DEBUG_CMB
-        emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: future or very old data sets: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
-            QString(" %1 ").arg(newClk._time.timestr().c_str()).toLatin1() + "vs. current time" +
-            QString(" %1 ").arg(currentTime.timestr().c_str()).toLatin1()), true);
-  #endif
-        continue;
-      }
     }
 
Index: trunk/BNC/src/combination/bnccomb.h
===================================================================
--- trunk/BNC/src/combination/bnccomb.h	(revision 11218)
+++ trunk/BNC/src/combination/bnccomb.h	(revision 11220)
@@ -257,4 +257,5 @@
   QMap<QString, bncTime>                     _acLastClkTime; // latest correction epoch per AC
   QMap<QString, bncTime>                     _refBiasWarned; // last warning per AC and system
+  QMap<QString, bncTime>                     _badEpochWarned; // last bad-epoch warning per AC (current time)
   QMap<char, bncTime>                        _singleACWarned; // last 'fewer than 2 ACs' message per system
   QMap<QString, QMap<QString, double> >      _acBiasIF;       // latest B_IF of the reference signals per AC and satellite
@@ -312,4 +313,6 @@
                    const QVector<t_datumObs>& datumObs, const ColumnVector& xx);
   bool allACsDelivered(const bncTime& epoTime) const;
+  bool epochOutOfRange(const QString& acName, const bncTime& epoTime, double maxOffset, const char* type,
+                       bool pastOk = false);
   bncTime                                    _resTime;
   cmbCorr*                                   _newCorr;
