]> mj.ucw.cz Git - libucw.git/commitdiff
Timer: get_timer() adds a random offset to catch misuse of timestamp_t
authorMartin Mares <mj@ucw.cz>
Sat, 11 Feb 2012 19:28:35 +0000 (20:28 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 11 Feb 2012 19:28:35 +0000 (20:28 +0100)
ucw/timer.c

index 41f51f94d7e3df48842b333d0ffe141f056d4327..31688dbe737c7fddc73c8b08713c23463665b015 100644 (file)
@@ -18,7 +18,11 @@ get_timestamp(void)
 {
   struct timeval tv;
   gettimeofday(&tv, NULL);
-  return (timestamp_t)tv.tv_sec * 1000 + tv.tv_usec / 1000;
+  return (timestamp_t)tv.tv_sec * 1000 + tv.tv_usec / 1000
+#ifdef CONFIG_UCW_DEBUG
+       + 3141592653    // So that we catch all attempts to corelate timestamp_t with wall clock
+#endif
+       ;
 }
 
 void