? GNUmakefile
? libCERTI/GettimeofdayClock.cc
? libCERTI/GettimeofdayClock.hh
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/CMakeLists.txt,v
retrieving revision 1.71
diff -u -r1.71 CMakeLists.txt
--- CMakeLists.txt	9 Oct 2009 21:13:56 -0000	1.71
+++ CMakeLists.txt	15 Oct 2009 06:07:42 -0000
@@ -56,6 +56,10 @@
 OPTION(FORCE_NO_X11 
               "Force not to use X11 (i.e. no Billard GUI)" OFF)   
         
+# On demand of Eric Noulard, the unsafe tsc clocksource
+OPTION(ENABLE_TSC_CLOCK
+             "Enable the usage of the timestamp counter as clock source (use with care)" OFF)
+
 # The communication channel to RTIA
 OPTION(RTIA_USE_TCP 
            "Force TCP socket usage between RTIA and FederateAmbassador (default is Unix Socket)" OFF)
@@ -183,12 +187,18 @@
     SET(HAVE_POSIX_CLOCK 1)
 ENDIF (HAVE_CLOCK_GETTIME AND HAVE_CLOCK_SETTIME AND HAVE_CLOCK_GETRES)
 
+################ Check for gettimeofday Support ###########
+CHECK_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H)
+CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
+
 ################ Check for TSCClock Support ###########
-SET(TSC_ENABLED_PROCESSOR_REGEX ".*x86_64.*|.*i686.*")
-MESSAGE(STATUS "CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
-IF (CMAKE_SYSTEM_PROCESSOR MATCHES "${TSC_ENABLED_PROCESSOR_REGEX}")
-    SET(HAVE_TSC_CLOCK 1)
-ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "${TSC_ENABLED_PROCESSOR_REGEX}")
+IF (ENABLE_TSC_CLOCK)
+    SET(TSC_ENABLED_PROCESSOR_REGEX ".*x86_64.*|.*i686.*")
+    MESSAGE(STATUS "CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
+    IF (CMAKE_SYSTEM_PROCESSOR MATCHES "${TSC_ENABLED_PROCESSOR_REGEX}")
+        SET(HAVE_TSC_CLOCK 1)
+    ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "${TSC_ENABLED_PROCESSOR_REGEX}")
+ENDIF (ENABLE_TSC_CLOCK)
 
 ENDIF (NOT WIN32)
 
Index: config.h.cmake
===================================================================
RCS file: /sources/certi/certi/config.h.cmake,v
retrieving revision 1.4
diff -u -r1.4 config.h.cmake
--- config.h.cmake	9 Oct 2009 21:13:56 -0000	1.4
+++ config.h.cmake	15 Oct 2009 06:07:42 -0000
@@ -109,6 +109,9 @@
 /* Define to 1 if you have clock_xxxx API */
 #cmakedefine HAVE_POSIX_CLOCK 1
 
+/* Define to 1 if you have gettimeofday API */
+#cmakedefine HAVE_GETTIMEOFDAY 1
+
 /* Define to 1 if the processor have TSC support */
 #cmakedefine HAVE_TSC_CLOCK 1
 
Index: libCERTI/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libCERTI/CMakeLists.txt,v
retrieving revision 1.26
diff -u -r1.26 CMakeLists.txt
--- libCERTI/CMakeLists.txt	14 Sep 2009 20:51:52 -0000	1.26
+++ libCERTI/CMakeLists.txt	15 Oct 2009 06:07:42 -0000
@@ -91,6 +91,12 @@
            PosixClock.cc PosixClock.hh)              
 ENDIF(HAVE_POSIX_CLOCK)
 
+IF (HAVE_GETTIMEOFDAY)
+    SET(CERTI_SUPPORT_SRCS 
+           ${CERTI_SUPPORT_SRCS}
+           GettimeofdayClock.cc GettimeofdayClock.hh)              
+ENDIF(HAVE_GETTIMEOFDAY)
+
 IF (HAVE_TSC_CLOCK)
     SET(CERTI_SUPPORT_SRCS 
            ${CERTI_SUPPORT_SRCS}
Index: libCERTI/ClockFactory.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ClockFactory.cc,v
retrieving revision 4.1
diff -u -r4.1 ClockFactory.cc
--- libCERTI/ClockFactory.cc	25 Nov 2008 15:13:58 -0000	4.1
+++ libCERTI/ClockFactory.cc	15 Oct 2009 06:07:42 -0000
@@ -26,6 +26,9 @@
 #ifdef HAVE_POSIX_CLOCK
 #include "PosixClock.hh"
 #endif
+#ifdef HAVE_GETTIMEOFDAY
+#include "GettimeofdayClock.hh"
+#endif
 
 #ifdef HAVE_WIN_CLOCK
 #include "WinClock.hh"
@@ -48,10 +51,15 @@
 
 #ifdef HAVE_POSIX_CLOCK
     return new PosixClock () ;
+
+#else
+#ifdef HAVE_GETTIMEOFDAY
+    return new GettimeofdayClock () ;
 #else
     return NULL ;
 #endif
 #endif
 #endif
+#endif
   } /* end of getBestClock */
 }
Index: test/utility/CertiUtilTests.cc
===================================================================
RCS file: /sources/certi/certi/test/utility/CertiUtilTests.cc,v
retrieving revision 1.15
diff -u -r1.15 CertiUtilTests.cc
--- test/utility/CertiUtilTests.cc	25 Nov 2008 15:13:58 -0000	1.15
+++ test/utility/CertiUtilTests.cc	15 Oct 2009 06:07:42 -0000
@@ -50,6 +50,9 @@
 #ifdef HAVE_POSIX_CLOCK
 #include "PosixClock.hh"
 #endif
+#ifdef HAVE_GETTIMEOFDAY
+#include "GettimeofdayClock.hh"
+#endif
 
 #ifdef HAVE_WIN_CLOCK
 #include "WinClock.hh"
@@ -246,6 +249,9 @@
 #ifdef HAVE_POSIX_CLOCK
 	certi::PosixClock posixClk;
 #endif
+#ifdef HAVE_GETTIMEOFDAY
+        certi::GettimeofdayClock gettimeofdayClock;
+#endif
 #ifdef HAVE_TSC_CLOCK
 	certi::TSCClock   tscClk;
 #endif
@@ -274,6 +280,9 @@
 #ifdef HAVE_POSIX_CLOCK
 	clockTests(posixClk);
 #endif
+#ifdef HAVE_GETTIMEOFDAY
+	clockTests(gettimeofdayClock);
+#endif
 #ifdef HAVE_WIN_CLOCK
 	clockTests(WinClk);
 	clockTests(WinPerfClk);
