Index: /trunk/FACT++/src/EventBuilderWrapper.h
===================================================================
--- /trunk/FACT++/src/EventBuilderWrapper.h	(revision 17318)
+++ /trunk/FACT++/src/EventBuilderWrapper.h	(revision 17319)
@@ -129,4 +129,28 @@
         const uint32_t night = now.NightAsInt();
         if (night==fNightAsInt)
+            return true;
+
+        const string crosscheck = now.GetPrevSunRise().GetAsStr("%Y%m%d");
+        if (crosscheck!=to_string(night))
+        {
+            fMsg.Warn("The crosscheck for the night failed. "+crosscheck+" is not equal to "+to_string(night)+"... keeping old one.");
+            fMsg.Warn("This is a severe error. Please restart fadctrl.");
+            return true;
+        }
+
+        // In some circumstances, I do not understand yet (but I guess it can happen
+        // when the shared objects are re-compiled while the program is not
+        // re-started), it can happen that the returned value is wrong by one day.
+        // So this is just another check to avoid problems.
+        const uint32_t night_test = Time(now-boost::posix_time::seconds(1)).NightAsInt();
+        if (night_test != night)
+            return true;
+
+        // And another check. Let's read the clock again.
+        // In both cases a false condition is no error and can happen. But if it happens,
+        // the bahaviour will change a fraction of a second later and the conditon
+        // will be true. No run should be taken just around that moment and if one
+        // is taken, then the date doesn't matter.
+        if (Time().NightAsInt() != night)
             return true;
 
