return storage of task interval back to 1 ns resolution (when calculating least common multiple et. al. of task intervals).
authorMario de Sousa <msousa@fe.up.pt>
Wed, 26 Dec 2018 11:51:58 +0000
changeset 1081 d8ed548e2f9b
parent 1078 81e2a100db14
child 1082 903e2782e405
return storage of task interval back to 1 ns resolution (when calculating least common multiple et. al. of task intervals).
stage4/generate_c/generate_c.cc
--- a/stage4/generate_c/generate_c.cc	Wed Dec 26 11:12:27 2018 +0000
+++ b/stage4/generate_c/generate_c.cc	Wed Dec 26 11:51:58 2018 +0000
@@ -544,7 +544,7 @@
 /***********************************************************************/
 /***********************************************************************/
 
-#define MILLISECOND 1
+#define MILLISECOND 1000000
 #define SECOND 1000 * MILLISECOND
 
 #define ULL_MAX std::numeric_limits<unsigned long long>::max()
@@ -626,8 +626,12 @@
       ovflow |= ((ULL_MAX - time_ull) < (unsigned long long)time_ld);
       time_ull += time_ld;
       
-      if (ovflow)
-        STAGE4_ERROR(symbol, symbol, "Internal overflow calculating task interval (must be <= 49 days).");
+      if (ovflow) {
+        /* time is being stored in ns resolution (MILLISECOND #define is set to 1000000)    */
+        /* time is being stored in unsigned long long (ISO C99 guarantees at least 64 bits) */
+        /* 2⁶64ns works out to around 584.5 years, assuming 365.25 days per year            */
+        STAGE4_ERROR(symbol, symbol, "Internal overflow calculating task interval (must be < 584 years).");
+      }
 
       return time_ull;
   };