Index: trunk/BNC/src/bncephuser.cpp
===================================================================
--- trunk/BNC/src/bncephuser.cpp	(revision 11217)
+++ trunk/BNC/src/bncephuser.cpp	(revision 11218)
@@ -293,23 +293,38 @@
   return val;
 }
-}
-
-QString bncEphUser::differingFields(const QByteArray& c1, const QByteArray& c2) {
+
+// Fields differing legitimately between the copies of the same data set
+// (receiver-dependent or informational): accuracy indices, GPS/QZSS L2 code
+// and fit flags, GLONASS almanac flags and day numbers, BDS AODE/AODC
+const char* minorFields1019[] = {"URA", "L2code", "L2P", "fit", 0};
+const char* minorFields1020[] = {"Cn", "A", "P", "P1", "P3", "FT", "NA", "N4", 0};
+const char* minorFields1042[] = {"URAI", "AODE", "AODC", 0};
+const char* minorFields1045[] = {"SISA", 0};
+
+// Names of the differing fields; empty: not decodable or no difference
+QStringList fieldDifferences(const QByteArray& c1, const QByteArray& c2, const char* const** minor) {
+  QStringList names;
+  if (minor) {
+    *minor = 0;
+  }
   if (c1.size() != c2.size() || c1.size() < 5) {
-    return "content";
+    return names;
   }
   const t_field* fields = 0;
+  const char* const* minorFields = 0;
   switch (getBits(c1, 24, 12)) {
-    case 1019: fields = fields1019; break;
-    case 1020: fields = fields1020; break;
-    case 1042: fields = fields1042; break;
-    case 1044: fields = fields1044; break;
-    case 1045: fields = fields1045; break;
-    case 1046: fields = fields1046; break;
+    case 1019: fields = fields1019; minorFields = minorFields1019; break;
+    case 1020: fields = fields1020; minorFields = minorFields1020; break;
+    case 1042: fields = fields1042; minorFields = minorFields1042; break;
+    case 1044: fields = fields1044; minorFields = minorFields1019; break;
+    case 1045: fields = fields1045; minorFields = minorFields1045; break;
+    case 1046: fields = fields1046; minorFields = minorFields1045; break;
   }
   if (!fields) {
-    return "content";
-  }
-  QStringList names;
+    return names;
+  }
+  if (minor) {
+    *minor = minorFields;
+  }
   int pos = 24;
   for (int ii = 0; fields[ii].name; ii++) {
@@ -322,4 +337,31 @@
     pos += fields[ii].nbits;
   }
+  return names;
+}
+}
+
+// Two vote contents differ only in fields differing legitimately between
+// receivers (see minorFields...)
+////////////////////////////////////////////////////////////////////////////
+bool bncEphUser::minorDifference(const QByteArray& c1, const QByteArray& c2) {
+  const char* const* minor = 0;
+  QStringList names = fieldDifferences(c1, c2, &minor);
+  if (names.isEmpty() || !minor) {
+    return false;
+  }
+  for (const QString& name : names) {
+    bool found = false;
+    for (int ii = 0; minor[ii]; ii++) {
+      found = found || name == minor[ii];
+    }
+    if (!found) {
+      return false;
+    }
+  }
+  return true;
+}
+
+QString bncEphUser::differingFields(const QByteArray& c1, const QByteArray& c2) {
+  QStringList names = fieldDifferences(c1, c2, 0);
   return names.isEmpty() ? QString("content") : names.join(" ");
 }
@@ -447,4 +489,5 @@
     }
   }
+  bool wasReleased = votes->_released;
   bool released = false;
   if (!votes->_released && count[iBest] >= VOTE_AGREE) {
@@ -452,5 +495,8 @@
     released = true;
   }
-  if (iBest == votes->_current) {
+  // after the upload, a copy differing only in receiver-dependent fields
+  // replaces it no more: receivers keep the first copy of a data set anyway
+  if (iBest == votes->_current ||
+      (wasReleased && minorDifference(votes->_content[votes->_current], votes->_content[iBest]))) {
     if (released) {
       ephBufferChanged();
Index: trunk/BNC/src/bncephuser.h
===================================================================
--- trunk/BNC/src/bncephuser.h	(revision 11217)
+++ trunk/BNC/src/bncephuser.h	(revision 11218)
@@ -60,4 +60,7 @@
   // than the current one, i.e. with at least three streams (only the latest
   // copy of each stream counts: a single stream may replace its own copy).
+  // Once uploaded, a data set is no more replaced by a copy differing only in
+  // receiver-dependent fields (accuracy indices, GPS/QZSS L2 code and fit
+  // flags, GLONASS almanac flags and day numbers, BDS AODE/AODC).
   // A new data set is held back from the upload (ephUpload() returns the
   // previous one) until three streams deliver the same content or VOTE_HOLD
@@ -134,4 +137,5 @@
   static QByteArray votingContent(const t_eph* eph);
   static QString    differingFields(const QByteArray& content1, const QByteArray& content2);
+  static bool       minorDifference(const QByteArray& content1, const QByteArray& content2);
   void   vote(const QString& prn, unsigned index, const t_eph* eph);
   void   checkEphemeris(t_eph* eph, bool realTime);
Index: trunk/BNC/src/bnchelp.html
===================================================================
--- trunk/BNC/src/bnchelp.html	(revision 11217)
+++ trunk/BNC/src/bnchelp.html	(revision 11218)
@@ -5332,5 +5332,6 @@
     <li>the update interval as declared in the messages (SSR Update Interval), the median and the maximum of the
       actual intervals,</li>
-    <li>the number of gaps, i.e. intervals longer than twice the larger of declared and median interval,</li>
+    <li>the number of gaps, i.e. intervals longer than twice the larger of declared and median interval,
+      without those overlapping a common outage of the input (see below),</li>
     <li>the number of epochs older than the previous one (out of order),</li>
     <li>the latency, median and maximum, i.e. the time of the decoded output minus the epoch time. BNC passes on
@@ -5339,4 +5340,17 @@
     <li>the number of satellites.</li>
   </ul>
+  <p>
+    A common outage of the input, i.e. a period in which at least 75 % (and at least 3) of the streams with data in
+    the interval had a gap at the same time, e.g. an outage of the caster or of the network connection of BNC, is
+    listed once below the table of each stream ('common outage of the input &lt;from&gt; - &lt;to&gt; (&lt;n&gt; of
+    &lt;m&gt; streams)'). It is not an Analysis Center problem: its gaps are not counted, and the latencies of the
+    epochs during it and up to 120 s after it, which reflect the delivery of buffered data, are left out of the
+    latency median and maximum. The maximum interval still contains it.
+  </p>
+  <p>
+    Corrections with an epoch time more than 900 seconds from their reception, e.g. an erroneously encoded GLONASS
+    epoch (see the decoder message 'SSR epoch time ... differs by ... s from the GPS SSR epoch time of the stream'),
+    are not used and their number is given below the table; they would otherwise move the report interval.
+  </p>
   <p>
     It is followed by the findings per system, only lines with findings are listed:
@@ -5355,4 +5369,13 @@
       as Galileo e.g. broadcasts a new data set every 10 minutes and Analysis Centers keep one for up to an
       hour,</li>
+    <li>the IOD switch: number of switches of the orbit corrections to a new data set and the delay of the first
+      correction referring to it after the reception of this data set by BNC (ephemeris streams), minimum, 10 %
+      quantile, median and maximum in seconds; for BDS, where all satellites get a new data set at the full hour
+      (TOC = issue time), also the delay after the TOC. Analysis Centers should not use a new data set before
+      60 seconds after its first broadcast, as receivers need this time to collect it; note that the reception by
+      BNC is itself delayed (ephemeris upload, majority vote, see section 2.16), so a value below 60 s is not
+      necessarily a violation, while the BDS delay after TOC is independent of BNC. A switch back to an older data
+      set is listed per satellite ('orbit corrections switching back to an older data set'); switching forward
+      again to the same new data set is not counted twice,</li>
     <li>the code bias signals provided, satellites without code biases of the reference signals (default GPS C1W/C2W,
       GLONASS C1P/C2P, Galileo C1C/C5Q, BDS C2I/C6I, QZSS C1C/C2L, SBAS C1C/C5Q; as in the combination, see option
@@ -8605,4 +8628,17 @@
 </pre>
   <p>
+    <b>Level of the combined clocks:</b>
+    The common level of the combined clocks of a system (with respect to the AC specific offsets) is defined by the
+    sum of the combined clocks over the satellites. A satellite is combined only if the AC providing the orbits
+    (master AC) delivers it; if it is missing in an epoch, e.g. because the master AC refers its correction to a new
+    ephemeris not yet received (BDS updates the ephemerides of all satellites at the full hour), a sum fixed to zero
+    over the satellites of each epoch would shift all other clocks of the system by the clock of the missing satellite
+    divided by the number of satellites (BDS: up to 1 m, at the next epoch back). Therefore the sum over the satellites
+    also combined in the previous epoch keeps its value; clocks of the previous epoch referring to another ephemeris
+    are converted to the current one. To keep the combined clocks referred to the broadcast clocks in the long run, this
+    sum relaxes to zero with a time constant of one hour, so that a permanent change of the combined satellites shifts
+    the clocks only slowly. After a gap of more than 60 seconds (and at the start) the sum is set to zero.
+  </p>
+  <p>
     Corrections can still be rejected persistently, e.g. for satellites provided by fewer than three ACs or for noisy
     clocks. This protects the combined clock, but it is worth to be reported to the AC. Therefore, once per hour and
@@ -10082,5 +10118,10 @@
     the latency before SSR providers may use the new IOD, 60 seconds after its broadcast; three streams agreed in the
     median after 14 seconds and in 87 percent of the data sets within 40 seconds with 89 input streams
-    (18 Nov 2026). A replacement after the upload is still possible. The content compared is the RTCM Version 3 message as uploaded, for GLONASS
+    (18 Nov 2026). A replacement after the upload is still possible, but only for differences beyond the fields
+    which differ legitimately between receivers (accuracy indices URA/URAI/SISA, GPS/QZSS L2 code, L2 P data and fit
+    flags, GLONASS almanac flags Cn/A, P, P1, P3, FT, day numbers NA/N4, BDS AODE/AODC): as receivers keep the first
+    copy anyway, such replacements would only change the content of the uploaded stream back and forth (751
+    replacements in 8 hours of 20 Nov 2026, nearly all of this kind); before the upload the majority decides on all
+    fields. The content compared is the RTCM Version 3 message as uploaded, for GLONASS
     without the frame time tk and the system time offsets tau_c and tau_GPS, which differ legitimately between
     receivers. This protects the uploaded stream against single receivers sending e.g. wrong health flags. Each
Index: trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/src/combination/bnccomb.cpp	(revision 11217)
+++ trunk/BNC/src/combination/bnccomb.cpp	(revision 11218)
@@ -43,4 +43,8 @@
 
 const double sigObs        =   0.05;
+
+// level of the combined clocks (regularization condition, see createAmat)
+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
 
 using namespace std;
@@ -1177,4 +1181,8 @@
   // --------------------------------------
   if (irc == success) {
+    if (_method == filter) {
+      _prevClk[sys].clear();
+      _prevClkTime[sys] = epoTime;
+    }
     for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
       cmbParam* pp = _params[sys][iPar-1];
@@ -1184,4 +1192,9 @@
           // set clock result
           masterCorr[pp->prn]->_dClkResult = pp->xx / t_CST::c;
+          if (_method == filter && masterCorr[pp->prn]->_eph) {
+            t_prevClk& prev = _prevClk[sys][pp->prn];
+            prev.clk = pp->xx;
+            prev.iod = masterCorr[pp->prn]->_eph->IOD();
+          }
           // Add Code Biases from SINEX File
           if (_bsx) {
@@ -2170,13 +2183,65 @@
   }
 
-  // Regularization
-  // --------------
+  // Regularization: level of the combined clocks
+  // ---------------------------------------------
+  // The sum of the combined clocks over the satellites of the epoch is not
+  // fixed to zero in each epoch: a satellite missing in one epoch (e.g. its
+  // correction of the master AC refers to an ephemeris not yet received, at
+  // the BDS ephemeris change every hour) shifted all other clocks of the
+  // system by its clock divided by the number of satellites (BDS: up to 1 m).
+  // Instead, the sum over the satellites also combined in the previous epoch
+  // keeps its value (continuity), relaxing to zero with CLK_LEVEL_TAU, so
+  // that the clocks stay referred to the broadcast clocks in the long run
+  // and a permanent change of the satellites shifts them only slowly. A
+  // previous clock of another ephemeris is converted to the current one
+  // (as in switchToLastEph). Without a previous epoch (start, gap longer
+  // than CLK_LEVEL_MAXGAP) the sum is zero.
+  QSet<int> presetRows;  // conditions with their value set here
   if (_method == filter) {
     const double Ph = 1.e6;
     PP(nObs+1) = Ph;
+    const bncTime epoTime = corrs(sys)[0]->_time;
+    const double  dtPrev  = _prevClkTime[sys].valid() ? epoTime - _prevClkTime[sys] : -1.0;
+    const bool    cont    = dtPrev > 0.0 && dtPrev <= CLK_LEVEL_MAXGAP;
+    double target  = 0.0;
+    int    nCommon = 0;
+    QList<int> allClk;
     for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
       cmbParam* pp = _params[sys][iPar-1];
       if ( AA.Column(iPar).maximum_absolute_value() > 0.0 &&
            pp->type == cmbParam::clkSat ) {
+        allClk << iPar;
+        if (!cont || !_prevClk[sys].contains(pp->prn) || !masterCorr.contains(pp->prn)) {
+          continue;
+        }
+        const t_prevClk& prev = _prevClk[sys][pp->prn];
+        const t_eph*     eph  = masterCorr[pp->prn]->_eph;
+        double prevClk = prev.clk;
+        if (eph->IOD() != prev.iod) {
+          const t_eph* ephOld = 0;
+          for (const t_eph* ee : {(const t_eph*)_ephUser.ephLast(pp->prn), (const t_eph*)_ephUser.ephPrev(pp->prn)}) {
+            if (ee && ee != eph && ee->IOD() == prev.iod) {
+              ephOld = ee;
+            }
+          }
+          ColumnVector xcNew(6), xcOld(6), vv(3);
+          if (!ephOld ||
+              eph->getCrd(epoTime, xcNew, vv, false) != success ||
+              ephOld->getCrd(epoTime, xcOld, vv, false) != success) {
+            continue;
+          }
+          prevClk -= (xcNew(4) - xcOld(4)) * t_CST::c;
+        }
+        AA(nObs+1, iPar) = 1.0;
+        target += prevClk;
+        ++nCommon;
+      }
+    }
+    if (nCommon > 0) {
+      ll(nObs+1) = (1.0 - min(1.0, dtPrev / CLK_LEVEL_TAU)) * target - DotProduct(AA.Row(nObs+1), x0);
+      presetRows.insert(1);
+    }
+    else {
+      for (int iPar : allClk) {
         AA(nObs+1, iPar) = 1.0;
       }
@@ -2290,5 +2355,5 @@
     // filter. Exception: incomplete nominal datum of a satellite (see above).
     for (int iCon = 1; iCon <= nCon; iCon++) {
-      if (!incrementRows.contains(iCon)) {
+      if (!incrementRows.contains(iCon) && !presetRows.contains(iCon)) {
         ll(nObs+iCon) = -DotProduct(AA.Row(nObs+iCon), x0);
       }
Index: trunk/BNC/src/combination/bnccomb.h
===================================================================
--- trunk/BNC/src/combination/bnccomb.h	(revision 11217)
+++ trunk/BNC/src/combination/bnccomb.h	(revision 11218)
@@ -266,4 +266,12 @@
   QMap<QString, int>                         _biasExclusions; // AC+system: number of exclusions (hysteresis)
   QMap<char, bncTime>                        _lastFilterEpoch;      // per system: last epoch of the filter prediction
+  // Combined clock of each satellite in the last epoch, for the continuity
+  // of the clock level (regularization condition, see createAmat)
+  struct t_prevClk {
+    double   clk = 0.0;   // [m], referred to the ephemeris with IOD iod
+    unsigned iod = 0;
+  };
+  QMap<char, QMap<QString, t_prevClk> >      _prevClk;       // per system, key full PRN
+  QMap<char, bncTime>                        _prevClkTime;   // per system: epoch of _prevClk
   void checkBiasConsistency(bncTime epoTime, char sys, QTextStream& out);
   void checkPersistentOutliers(bncTime epoTime, char sys, QTextStream& out);
Index: trunk/BNC/src/ssrQc.cpp
===================================================================
--- trunk/BNC/src/ssrQc.cpp	(revision 11217)
+++ trunk/BNC/src/ssrQc.cpp	(revision 11218)
@@ -59,4 +59,8 @@
   const double EPH_IOD_REUSE  = 21600.0; // [s] an outdated data set this far from the epoch: IOD reused
   const unsigned EPH_KEPT     = 30;    // data sets kept per satellite
+  const double OUTAGE_FRACTION = 0.75; // common outage: streams with a gap at the same time
+  const unsigned OUTAGE_MIN_STA = 3;   //   (at least this many)
+  const double OUTAGE_LAT_AFTER = 120.0; // [s] latencies left out after a common outage
+  const double MAX_EPOCH_OFFSET = 900.0; // [s] corrections with epochs further from their reception not used
   const double CMP_SAMPL      = 30.0;  // [s] sampling of the stream comparison
   const double CMP_DELAY      = 60.0;  // [s] epochs compared when data this much newer arrived
@@ -370,8 +374,10 @@
     if (stat.last.valid()) {
       stat.intervals.push_back(time - stat.last);
+      stat.intervalEnds.push_back(tKey(time));
     }
     stat.last = time;
     stat.numEpo += 1;
     stat.latencies.push_back(currentTime() - time);
+    stat.latencyEpochs.push_back(tKey(time));
   }
   else if (time < stat.last) {
@@ -450,4 +456,64 @@
 }
 
+// Switch of the orbit corrections to another IOD
+////////////////////////////////////////////////////////////////////////////
+void t_ssrQc::checkIodSwitch(t_satStat& stat, const QString& staID, const QString& prnInt,
+                             unsigned iod, const bncTime& time) {
+  bool     first   = !stat.orbIodSet;
+  unsigned prevIod = stat.orbIod;
+  stat.orbIodSet = true;
+  stat.orbIod    = iod;
+  if (!first && iod == prevIod) {
+    return;
+  }
+  // data set of an IOD (not one with a reused IOD)
+  auto dataSet = [this, &prnInt, &time](unsigned ii) -> t_eph* {
+    t_eph* eph = _ephUser.ephWithIOD(prnInt, ii);
+    return (eph && fabs(time - eph->TOC()) <= EPH_IOD_REUSE) ? eph : 0;
+  };
+  t_eph* eph = dataSet(iod);
+  if (!eph) {
+    return;
+  }
+  if (first || !stat.newestToc.valid()) {
+    stat.newestToc = eph->TOC();
+    return;
+  }
+  t_eph* prev = dataSet(prevIod);
+  char sys = eph->prn().system();
+  QString staSys = QString("%1 %2").arg(staID).arg(sys);
+  if (prev && eph->TOC() < prev->TOC()) {
+    _iodSwitch[staSys].back[QString::fromStdString(eph->prn().toString())] += 1;
+    return;
+  }
+  // first switch to this data set (not again after switching back), not
+  // before all broadcast ephemerides may have been received
+  if (!(stat.newestToc < eph->TOC())) {
+    return;
+  }
+  stat.newestToc = eph->TOC();
+  if (!eph->receptDateTime().isValid() || time - _staStart[staID] < EPH_WARMUP) {
+    return;
+  }
+  bncTime recept(eph->receptDateTime().toString(Qt::ISODate).toStdString());
+  t_iodSwitchStat& sw = _iodSwitch[staSys];
+  sw.afterRecept.push_back(currentTime() - recept);
+  if (sys == 'C') {
+    sw.afterToc.push_back(time - eph->TOC());
+  }
+}
+
+// Epoch time far from the reception time, e.g. a GLONASS epoch erroneously
+// encoded 11758 s ahead (SHA1/GFZ1 22 Nov 2026): not used, as it would move
+// the report interval (no reports for hours) and distort all statistics
+////////////////////////////////////////////////////////////////////////////
+bool t_ssrQc::badEpoch(const string& staID, const bncTime& time) {
+  if (fabs(currentTime() - time) <= MAX_EPOCH_OFFSET) {
+    return false;
+  }
+  _badEpochs[QString::fromStdString(staID)] += 1;
+  return true;
+}
+
 // Orbit corrections
 ////////////////////////////////////////////////////////////////////////////
@@ -455,4 +521,5 @@
   QMutexLocker locker(&_mutex);
   for (const t_orbCorr& corr : orbCorrections) {
+    if (badEpoch(corr._staID, corr._time)) continue;
     if (!_excluded.contains(QString::fromStdString(corr._staID)) || corr._staID == _reference.toStdString()) {
       storeHist(&corr, 0);
@@ -467,4 +534,6 @@
     checkEph(stat, QString::fromStdString(corr._staID) + ' ' + prn,
              QString::fromStdString(corr._prn.toInternalString()), corr._iod, corr._time, corr._staID);
+    checkIodSwitch(stat, QString::fromStdString(corr._staID),
+                   QString::fromStdString(corr._prn.toInternalString()), corr._iod, corr._time);
     double radial = fabs(corr._xr[0]);
     double alongCross = max(fabs(corr._xr[1]), fabs(corr._xr[2]));
@@ -479,4 +548,5 @@
   QMutexLocker locker(&_mutex);
   for (const t_clkCorr& corr : clkCorrections) {
+    if (badEpoch(corr._staID, corr._time)) continue;
     if (!_excluded.contains(QString::fromStdString(corr._staID)) || corr._staID == _reference.toStdString()) {
       storeHist(0, &corr);
@@ -515,4 +585,5 @@
   QMutexLocker locker(&_mutex);
   for (const t_satCodeBias& bias : codeBiases) {
+    if (badEpoch(bias._staID, bias._time)) continue;
     bool sel = selected(bias._staID);
     if (_excluded.contains(QString::fromStdString(bias._staID)) && bias._staID != _reference.toStdString()) continue;
@@ -564,4 +635,5 @@
   QMutexLocker locker(&_mutex);
   for (const t_satPhaseBias& bias : phaseBiases) {
+    if (badEpoch(bias._staID, bias._time)) continue;
     QString staID = QString::fromStdString(bias._staID);
     QString prn   = QString::fromStdString(bias._prn.toString());
@@ -1516,5 +1588,5 @@
 void t_ssrQc::slotNewTec(t_vTec vTec) {
   QMutexLocker locker(&_mutex);
-  if (vTec._layers.empty()) {
+  if (vTec._layers.empty() || badEpoch(vTec._staID, vTec._time)) {
     return;
   }
@@ -1696,4 +1768,23 @@
   }
 
+  // common outages of the input, reported in each stream's report
+  QVector<t_outage> outages = commonOutages(streams);
+  auto inOutage = [&outages](double t0, double t1) {   // window [t0, t1] overlaps an outage
+    for (const t_outage& oo : outages) {
+      if (t0 < oo.end && t1 > oo.start) return true;
+    }
+    return false;
+  };
+  auto afterOutage = [&outages](double tt) {
+    for (const t_outage& oo : outages) {
+      if (tt > oo.start && tt <= oo.end + OUTAGE_LAT_AFTER) return true;
+    }
+    return false;
+  };
+  auto tStr = [](double tt) {
+    bncTime bt(int(tt / 604800.0), tt - 604800.0 * int(tt / 604800.0));
+    return QString::fromStdString(bt.datestr() + ' ' + bt.timestr(0));
+  };
+
   QMapIterator<QString, QSet<char> > itSta(streams);
   while (itSta.hasNext()) {
@@ -1727,11 +1818,19 @@
         double ref = max(double(stat.nominal), medInt);
         unsigned gaps = 0;
-        for (double dt : stat.intervals) {
-          if (ref > 0.0 && dt > 2.0 * ref) {
+        for (int ii = 0; ii < stat.intervals.size(); ii++) {
+          double dt = stat.intervals[ii];
+          if (ref > 0.0 && dt > 2.0 * ref &&
+              !inOutage(stat.intervalEnds[ii] - dt, stat.intervalEnds[ii])) {
             ++gaps;
           }
         }
-        double maxLat = stat.latencies.isEmpty() ? 0.0 :
-                        *std::max_element(stat.latencies.begin(), stat.latencies.end());
+        QVector<double> latencies;
+        for (int ii = 0; ii < stat.latencies.size(); ii++) {
+          if (!afterOutage(stat.latencyEpochs[ii])) {
+            latencies.push_back(stat.latencies[ii]);
+          }
+        }
+        double maxLat = latencies.isEmpty() ? 0.0 :
+                        *std::max_element(latencies.begin(), latencies.end());
         out << "  " << sys << "   " << left << setw(10) << TYPE_NAME[type] << right
               << setw(8) << stat.numEpo
@@ -1739,7 +1838,18 @@
               << " /" << setw(7) << maxInt
               << setw(6) << gaps << setw(14) << stat.numOutOfOrder
-              << setw(10) << median(stat.latencies) << " /" << setw(7) << maxLat
+              << setw(10) << median(latencies) << " /" << setw(7) << maxLat
               << setw(7) << stat.sats.size() << endl;
       }
+    }
+
+    for (const t_outage& oo : outages) {
+      out << "  common outage of the input " << tStr(oo.start).toStdString() << " - "
+          << tStr(oo.end).toStdString() << " (" << oo.numSta << " of " << oo.numAll
+          << " streams): not counted as gaps, latencies until " << int(OUTAGE_LAT_AFTER)
+          << " s after it left out" << endl;
+    }
+    if (_badEpochs.value(staID)) {
+      out << "  corrections with an epoch time more than " << int(MAX_EPOCH_OFFSET)
+          << " s from their reception, not used: " << _badEpochs.value(staID) << endl;
     }
 
@@ -1901,4 +2011,24 @@
       addSats("corrections for satellites without broadcast ephemeris", noEph);
       QString staSys = QString("%1 %2").arg(staID).arg(sys);
+      if (_iodSwitch.contains(staSys)) {
+        const t_iodSwitchStat& sw = _iodSwitch[staSys];
+        // quantiles "min / 10 % / median / max"
+        auto quant = [](QVector<double> vv) {
+          std::sort(vv.begin(), vv.end());
+          return QString("%1 / %2 / %3 / %4").arg(vv.first(), 0, 'f', 0)
+                 .arg(vv[int(0.1 * (vv.size() - 1))], 0, 'f', 0)
+                 .arg(median(vv), 0, 'f', 0).arg(vv.last(), 0, 'f', 0);
+        };
+        if (!sw.afterRecept.isEmpty()) {
+          QString line = QString("IOD switch to new data sets (%1), delay after their reception by BNC "
+                                 "(ephemeris streams) min / 10 % / median / max: %2 s")
+                         .arg(sw.afterRecept.size()).arg(quant(sw.afterRecept));
+          if (!sw.afterToc.isEmpty()) {
+            line += QString(", after TOC: %1 s").arg(quant(sw.afterToc));
+          }
+          lines << line;
+        }
+        addSats("orbit corrections switching back to an older data set", sw.back);
+      }
       if (_codeSignals.contains(staSys)) {
         QStringList sigs = _codeSignals[staSys].values();
@@ -2115,4 +2245,6 @@
   _cmpStat.clear();
   _cmpEpochs.clear();
+  _iodSwitch.clear();
+  _badEpochs.clear();
   _attEvents.clear();
   _pbIndStat.clear();
@@ -2142,5 +2274,89 @@
     fresh.refBiasOK     = stat.refBiasOK;
     fresh.biasIF        = stat.biasIF;
+    fresh.orbIodSet     = stat.orbIodSet;
+    fresh.orbIod        = stat.orbIod;
+    fresh.newestToc     = stat.newestToc;
     stat = fresh;
   }
 }
+
+// Common outages of the input in the report interval: windows in which at
+// least OUTAGE_FRACTION (and OUTAGE_MIN_STA) of the streams with data had a
+// gap (interval > 2 x max(declared, median) of any of its message types)
+////////////////////////////////////////////////////////////////////////////
+QVector<t_ssrQc::t_outage> t_ssrQc::commonOutages(const QMap<QString, QSet<char> >& streams) const {
+  QVector<t_outage> outages;
+  // gap windows per stream, merged over the message types
+  QMap<double, int> events;   // time: change of the number of streams in a gap
+  unsigned numAll = 0;
+  QMapIterator<QString, QSet<char> > itSta(streams);
+  while (itSta.hasNext()) {
+    itSta.next();
+    QVector<QPair<double, double> > wins;
+    bool hasData = false;
+    for (char sys : itSta.value()) {
+      for (int type = ORB; type <= VTEC; type++) {
+        QString kk = QString("%1 %2 %3").arg(itSta.key()).arg(sys).arg(type);
+        if (!_epoStat.contains(kk)) continue;
+        const t_epoStat& stat = _epoStat[kk];
+        hasData = hasData || stat.numEpo > 0;
+        double ref = max(double(stat.nominal), median(stat.intervals));
+        for (int ii = 0; ii < stat.intervals.size(); ii++) {
+          if (ref > 0.0 && stat.intervals[ii] > 2.0 * ref) {
+            wins.push_back(qMakePair(stat.intervalEnds[ii] - stat.intervals[ii], stat.intervalEnds[ii]));
+          }
+        }
+      }
+    }
+    if (!hasData) continue;
+    ++numAll;
+    // gap of the stream: all its message types interrupted (intersection
+    // would need equal epochs; the union of overlapping windows of the
+    // types is used, a gap of a single type rarely coincides with others)
+    std::sort(wins.begin(), wins.end());
+    QVector<QPair<double, double> > merged;
+    for (const QPair<double, double>& ww : wins) {
+      if (!merged.isEmpty() && ww.first <= merged.last().second) {
+        merged.last().second = max(merged.last().second, ww.second);
+      }
+      else {
+        merged.push_back(ww);
+      }
+    }
+    for (const QPair<double, double>& ww : merged) {
+      events[ww.first]  += 1;
+      events[ww.second] -= 1;
+    }
+  }
+  unsigned need = max(OUTAGE_MIN_STA, unsigned(ceil(OUTAGE_FRACTION * numAll)));
+  if (numAll < need) {
+    return outages;
+  }
+  int      level = 0;
+  unsigned maxLevel = 0;
+  double   start = 0.0;
+  bool     open = false;
+  QMapIterator<double, int> itE(events);
+  while (itE.hasNext()) {
+    itE.next();
+    level += itE.value();
+    if (!open && level >= int(need)) {
+      open = true;
+      start = itE.key();
+      maxLevel = level;
+    }
+    else if (open && level >= int(need)) {
+      maxLevel = max(maxLevel, unsigned(level));
+    }
+    else if (open && level < int(need)) {
+      open = false;
+      t_outage oo;
+      oo.start  = start;
+      oo.end    = itE.key();
+      oo.numSta = maxLevel;
+      oo.numAll = numAll;
+      outages.push_back(oo);
+    }
+  }
+  return outages;
+}
Index: trunk/BNC/src/ssrQc.h
===================================================================
--- trunk/BNC/src/ssrQc.h	(revision 11217)
+++ trunk/BNC/src/ssrQc.h	(revision 11218)
@@ -49,5 +49,7 @@
     bncTime         last;
     QVector<double> intervals;
+    QVector<double> intervalEnds;  // [s] (tKey) epoch ending each interval
     QVector<double> latencies;
+    QVector<double> latencyEpochs; // [s] (tKey) epoch of each latency
     QSet<QString>   sats;
   };
@@ -79,5 +81,39 @@
     unsigned      numYaw = 0;    // phase bias records with yaw angle
     unsigned      pbJumps = 0;   // changes of the phase bias discontinuity counter
-  };
+    bool          orbIodSet = false; // IOD of the orbit corrections (kept across intervals)
+    unsigned      orbIod    = 0;
+    bncTime       newestToc;     // TOC of the newest data set referred to so far
+  };
+
+  // IOD switch: delay of the first orbit correction referring to a new data
+  // set after its reception by BNC (ephemeris streams) and, for BDS (all
+  // satellites updated at the full hour, TOC = issue time), after its TOC;
+  // switches back to an older data set
+  class t_iodSwitchStat {    // per stream and system
+   public:
+    QVector<double>         afterRecept;  // [s]
+    QVector<double>         afterToc;     // [s]
+    QMap<QString, unsigned> back;         // PRN: switches back
+  };
+  void   checkIodSwitch(t_satStat& stat, const QString& staID, const QString& prnInt,
+                        unsigned iod, const bncTime& time);
+  QMap<QString, t_iodSwitchStat> _iodSwitch;  // key "STA SYS"
+
+  // Common outages of the input: gaps of at least OUTAGE_FRACTION of the
+  // streams at the same time (e.g. caster, network); reported once, not
+  // counted as gaps of the single streams and their latencies left out
+  class t_outage {
+   public:
+    double   start;          // [s] (tKey)
+    double   end;
+    unsigned numSta;         // streams with a gap
+    unsigned numAll;         // streams with data in the interval
+  };
+  QVector<t_outage> commonOutages(const QMap<QString, QSet<char> >& streams) const;
+
+  // Corrections with an epoch time far from the reception time (erroneously
+  // encoded): not used, counted per stream
+  bool   badEpoch(const std::string& staID, const bncTime& time);
+  QMap<QString, unsigned> _badEpochs;
 
   void   newEpoch(const std::string& staID, char sys, e_type type, const bncTime& time,
