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)
