Index: /trunk/BNC/CHANGELOG.md
===================================================================
--- /trunk/BNC/CHANGELOG.md	(revision 11140)
+++ /trunk/BNC/CHANGELOG.md	(revision 11141)
@@ -28,4 +28,5 @@
 - CHANGED: SSR QC: the IOD of the corrections is looked up among the last 30 data sets of a satellite instead of the last two (false 'IOD of no received broadcast ephemeris' for Galileo and GLONASS); new report lines for IODs received from the ephemeris stream(s) only later (with the largest delay) and for corrections referring to a broadcast ephemeris outside its validity
 - ADDED: General option 'Ephemeris streams' (key ephMount): combination, upload of corrections and SSR QC use the Broadcast Ephemeris of the given stream(s) only, e.g. BCEP00BKG0, not those contained in other streams (e.g. RTCM-SSR streams of ACs with ephemeris messages); PPP, RINEX navigation files and ephemeris upload not affected; empty: all streams as before
+- FIXED: Galileo (RTCM 1045/1046) and BDS (1042) ephemerides: the week number (12 bit GST week, 13 bit BDT week) is completed with the current week, so the decoding continues after their roll-over (GST week 4095 in 2078, BDT week 8191 in 2163)
 - ADDED: Regression test suite ('tests'): example configurations and short raw captures replayed through BNC and compared with reference outputs
 - ADDED: macOS packaging script
Index: /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 11140)
+++ /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 11141)
@@ -1742,5 +1742,5 @@
     checkPrnRange(eph._prn);
 
-    GETBITS(week, 12) //FIXME: roll-over after week 4095!!
+    GETBITS(week, 12) // GST week modulo 4096
     if (week < 0 || week > 4095) {
 #ifdef BNC_DEBUG_BCE
@@ -1753,4 +1753,10 @@
       return false;
     }
+    // full GST week (roll-over after GST week 4095, in 2078): the one closest
+    // to the current week; GST week 0 = GPS week 1024
+    int currentWeek;
+    double currentSec;
+    currentGPSWeeks(currentWeek, currentSec);
+    week += 4096 * int(floor((currentWeek - 1024 - week) / 4096.0 + 0.5));
     eph._TOEweek = week;
     GETBITS(eph._IODnav, 10)
@@ -1769,5 +1775,5 @@
       return false;
     }
-    eph._TOC.set(1024 + eph._TOEweek, i);// Period #2 = + 1 x 1024 (has to be determined)
+    eph._TOC.set(1024 + eph._TOEweek, i); // GPS week = GST week + 1024
     GETFLOATSIGN(eph._clock_driftrate, 6, 1.0 / (double )(1 << 30) / (double )(1 << 29))
     GETFLOATSIGN(eph._clock_drift,    21, 1.0 / (double )(1 << 30) / (double )(1 << 16))
@@ -1901,4 +1907,10 @@
       return false;
     }
+    // full BDT week (roll-over after BDT week 8191, in 2163): the one closest
+    // to the current week; BDT week 0 = GPS week 1356
+    int currentWeek;
+    double currentSec;
+    currentGPSWeeks(currentWeek, currentSec);
+    week += 8192 * int(floor((currentWeek - 1356 - week) / 8192.0 + 0.5));
     eph._BDTweek = week;
     GETBITS(i, 4)
