diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-11-06 18:06:49 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-11-06 18:06:49 (GMT) |
commit | d7ee016535a12737b9abb41e4032a6a5ab85b095 (patch) | |
tree | 0bccce88590c6fb008b186526d67be38ab09beb1 /Source/ctest.cxx | |
parent | 3d4a2fdc52fa01353653afc8835653559f14e10b (diff) | |
download | CMake-d7ee016535a12737b9abb41e4032a6a5ab85b095.zip CMake-d7ee016535a12737b9abb41e4032a6a5ab85b095.tar.gz CMake-d7ee016535a12737b9abb41e4032a6a5ab85b095.tar.bz2 |
Move the hi-res time to system tools
Diffstat (limited to 'Source/ctest.cxx')
-rw-r--r-- | Source/ctest.cxx | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 45f1f47..d17ce2c 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -21,61 +21,6 @@ #include <stdio.h> #include <time.h> - -/* Implement floattime() for various platforms */ -// Taken from Python 2.1.3 - -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -# include <sys/timeb.h> -# define HAVE_FTIME -# if defined( __BORLANDC__) -# define FTIME ftime -# define TIMEB timeb -# else // Visual studio? -# define FTIME _ftime -# define TIMEB _timeb -# endif -#elif defined( __CYGWIN__ ) || defined( __linux__ ) -# include <sys/time.h> -# define HAVE_GETTIMEOFDAY -#endif - -static double -floattime(void) -{ - /* There are three ways to get the time: - (1) gettimeofday() -- resolution in microseconds - (2) ftime() -- resolution in milliseconds - (3) time() -- resolution in seconds - In all cases the return value is a float in seconds. - Since on some systems (e.g. SCO ODT 3.0) gettimeofday() may - fail, so we fall back on ftime() or time(). - Note: clock resolution does not imply clock accuracy! */ -#ifdef HAVE_GETTIMEOFDAY - { - struct timeval t; -#ifdef GETTIMEOFDAY_NO_TZ - if (gettimeofday(&t) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; -#else /* !GETTIMEOFDAY_NO_TZ */ - if (gettimeofday(&t, (struct timezone *)NULL) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; -#endif /* !GETTIMEOFDAY_NO_TZ */ - } -#endif /* !HAVE_GETTIMEOFDAY */ - { -#if defined(HAVE_FTIME) - struct TIMEB t; - FTIME(&t); - return (double)t.time + (double)t.millitm * (double)0.001; -#else /* !HAVE_FTIME */ - time_t secs; - time(&secs); - return (double)secs; -#endif /* !HAVE_FTIME */ - } -} - static std::string CleanString(std::string str) { std::string::size_type spos = str.find_first_not_of(" \n\t"); @@ -874,7 +819,7 @@ void ctest::ProcessDirectory(std::vector<std::string> &passed, int retVal; double clock_start, clock_finish; - clock_start = floattime(); + clock_start = cmSystemTools::GetTime(); if ( m_Verbose ) { @@ -882,7 +827,7 @@ void ctest::ProcessDirectory(std::vector<std::string> &passed, } bool res = cmSystemTools::RunCommand(testCommand.c_str(), output, retVal, 0, false); - clock_finish = floattime(); + clock_finish = cmSystemTools::GetTime(); cres.m_ExecutionTime = (double)(clock_finish - clock_start); cres.m_FullCommandLine = testCommand; |