--- a/src/utils/smallut.cpp
+++ b/src/utils/smallut.cpp
@@ -743,181 +743,6 @@
query= query.substr(ss.length());
}
return oq;
-}
-
-////////////////////
-
-#if 0
-// Internal redefinition of system time interface to help with dependancies
-struct m_timespec {
- time_t tv_sec;
- long tv_nsec;
-};
-#endif
-
-#ifndef CLOCK_REALTIME
-typedef int clockid_t;
-#define CLOCK_REALTIME 1
-#endif
-
-#define MILLIS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000L + \
- ((TV).tv_nsec - m_nsecs) / 1000000))
-#define MICROS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000000L + \
- ((TV).tv_nsec - m_nsecs) / 1000))
-#define NANOS(TV) ( (long long)(((TV).tv_sec - m_secs) * 1000000000LL + \
- ((TV).tv_nsec - m_nsecs)))
-
-// Using clock_gettime() is nice because it gives us ns res and it helps with
-// computing threads work times, but it's also a pita because it forces linking
-// with -lrt. So keep it optional. And not on the mac anyway
-// #define USE_CLOCK_GETTIME
-
-#ifdef __APPLE__
-#undef USE_CLOCK_GETTIME
-#endif
-
-#ifdef WIN32
-#include "safewindows.h"
-// Note: struct timespec is defined by pthread.h (from pthreads-w32)
-#ifndef CLOCK_REALTIME
-#define CLOCK_REALTIME 0
-#endif
-
-LARGE_INTEGER getFILETIMEoffset()
-{
- SYSTEMTIME s;
- FILETIME f;
- LARGE_INTEGER t;
-
- s.wYear = 1970;
- s.wMonth = 1;
- s.wDay = 1;
- s.wHour = 0;
- s.wMinute = 0;
- s.wSecond = 0;
- s.wMilliseconds = 0;
- SystemTimeToFileTime(&s, &f);
- t.QuadPart = f.dwHighDateTime;
- t.QuadPart <<= 32;
- t.QuadPart |= f.dwLowDateTime;
- return (t);
-}
-
-int clock_gettime(int X, struct timespec *tv)
-{
- LARGE_INTEGER t;
- FILETIME f;
- double microseconds;
- static LARGE_INTEGER offset;
- static double frequencyToMicroseconds;
- static int initialized = 0;
- static BOOL usePerformanceCounter = 0;
-
- if (!initialized) {
- LARGE_INTEGER performanceFrequency;
- initialized = 1;
- usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency);
- if (usePerformanceCounter) {
- QueryPerformanceCounter(&offset);
- frequencyToMicroseconds = (double)performanceFrequency.QuadPart / 1000000.;
- }
- else {
- offset = getFILETIMEoffset();
- frequencyToMicroseconds = 10.;
- }
- }
- if (usePerformanceCounter) QueryPerformanceCounter(&t);
- else {
- GetSystemTimeAsFileTime(&f);
- t.QuadPart = f.dwHighDateTime;
- t.QuadPart <<= 32;
- t.QuadPart |= f.dwLowDateTime;
- }
-
- t.QuadPart -= offset.QuadPart;
- microseconds = (double)t.QuadPart / frequencyToMicroseconds;
- t.QuadPart = (long long)microseconds;
- tv->tv_sec = t.QuadPart / 1000000;
- tv->tv_nsec = (t.QuadPart % 1000000) * 1000;
- return (0);
-}
-#define USE_CLOCK_GETTIME
-#else /* -> !_WIN32 */
-
-#ifndef USE_CLOCK_GETTIME
-#include <sys/time.h>
-#endif
-
-#endif
-
-static void gettime(clockid_t clk_id, struct timespec *ts)
-{
-#ifndef USE_CLOCK_GETTIME
- struct timeval tv;
- gettimeofday(&tv, 0);
- ts->tv_sec = tv.tv_sec;
- ts->tv_nsec = tv.tv_usec * 1000;
-#else
- clock_gettime(clk_id, ts);
-#endif
-}
-///// End system interface
-
-// Note: this not protected against multithread access and not reentrant, but
-// this is mostly debug code, and it won't crash, just show bad results. Also
-// the frozen thing is not used that much
-static timespec frozen_tv;
-void Chrono::refnow()
-{
- gettime(CLOCK_REALTIME, &frozen_tv);
-}
-
-Chrono::Chrono()
-{
- restart();
-}
-
-// Reset and return value before rest in milliseconds
-time_t Chrono::restart()
-{
- struct timespec tv;
- gettime(CLOCK_REALTIME, &tv);
- time_t ret = MILLIS(tv);
- m_secs = tv.tv_sec;
- m_nsecs = tv.tv_nsec;
- return ret;
-}
-
-// Get current timer value, milliseconds
-time_t Chrono::millis(int frozen)
-{
- return nanos() / 1000000;
-}
-
-//
-time_t Chrono::micros(int frozen)
-{
- return nanos() / 1000;
-}
-
-time_t Chrono::nanos(int frozen)
-{
- if (frozen) {
- return NANOS(frozen_tv);
- } else {
- struct timespec tv;
- gettime(CLOCK_REALTIME, &tv);
- return NANOS(tv);
- }
-}
-
-double Chrono::secs(int frozen)
-{
- struct timespec tv;
- gettime(CLOCK_REALTIME, &tv);
- double secs = (double)(frozen?frozen_tv.tv_sec:tv.tv_sec - m_secs);
- double nsecs = (double)(frozen?frozen_tv.tv_nsec:tv.tv_nsec - m_nsecs);
- return secs + nsecs * 1e-9;
}
// Date is Y[-M[-D]]