summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-12-28 22:24:09 +0100
committerMax Kellermann <max@musicpd.org>2016-12-28 22:24:09 +0100
commit837134daef014d1af3d8dbe63da1229e8c8d6965 (patch)
tree43f66db149374f3ca9aec0c765b41119d65fc997
parent4011899846958f324fd9beb19e4d01096bb18156 (diff)
system/Clock: remove obsolete MonotonicClock*() functions
We're using std::chrono::steady_clock now. No need to duplicate code.
-rw-r--r--src/system/Clock.cxx98
-rw-r--r--src/system/Clock.hxx23
2 files changed, 0 insertions, 121 deletions
diff --git a/src/system/Clock.cxx b/src/system/Clock.cxx
index 4a880ccf2..70b4a50ad 100644
--- a/src/system/Clock.cxx
+++ b/src/system/Clock.cxx
@@ -21,104 +21,6 @@
#ifdef WIN32
#include <windows.h>
-#elif defined(__APPLE__)
-#include <mach/mach_time.h>
-#else
-#include <time.h>
-#ifndef CLOCK_MONOTONIC
-#include <sys/time.h>
-#endif
-#endif
-
-unsigned
-MonotonicClockS(void)
-{
-#ifdef WIN32
- return GetTickCount() / 1000;
-#elif defined(__APPLE__) /* OS X does not define CLOCK_MONOTONIC */
- static mach_timebase_info_data_t base;
- if (base.denom == 0)
- (void)mach_timebase_info(&base);
-
- return (unsigned)(((double)mach_absolute_time() * base.numer / 1000)
- / base.denom / 1000000);
-#elif defined(CLOCK_MONOTONIC)
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return ts.tv_sec;
-#else
- /* we have no monotonic clock, fall back to time() */
- return time(nullptr);
-#endif
-}
-
-unsigned
-MonotonicClockMS(void)
-{
-#ifdef WIN32
- return GetTickCount();
-#elif defined(__APPLE__) /* OS X does not define CLOCK_MONOTONIC */
- static mach_timebase_info_data_t base;
- if (base.denom == 0)
- (void)mach_timebase_info(&base);
-
- return (unsigned)(((double)mach_absolute_time() * base.numer)
- / base.denom / 1000000);
-#elif defined(CLOCK_MONOTONIC)
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
-#else
- /* we have no monotonic clock, fall back to gettimeofday() */
- struct timeval tv;
- gettimeofday(&tv, 0);
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
-#endif
-}
-
-uint64_t
-MonotonicClockUS(void)
-{
-#ifdef WIN32
- LARGE_INTEGER l_value, l_frequency;
-
- if (!QueryPerformanceCounter(&l_value) ||
- !QueryPerformanceFrequency(&l_frequency))
- return 0;
-
- uint64_t value = l_value.QuadPart;
- uint64_t frequency = l_frequency.QuadPart;
-
- if (frequency > 1000000) {
- value *= 10000;
- value /= frequency / 100;
- } else if (frequency < 1000000) {
- value *= 10000;
- value /= frequency;
- value *= 100;
- }
-
- return value;
-#elif defined(__APPLE__) /* OS X does not define CLOCK_MONOTONIC */
- static mach_timebase_info_data_t base;
- if (base.denom == 0)
- (void)mach_timebase_info(&base);
-
- return (uint64_t)(((double)mach_absolute_time() * base.numer)
- / base.denom / 1000);
-#elif defined(CLOCK_MONOTONIC)
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return (uint64_t)ts.tv_sec * 1000000 + (uint64_t)(ts.tv_nsec / 1000);
-#else
- /* we have no monotonic clock, fall back to gettimeofday() */
- struct timeval tv;
- gettimeofday(&tv, 0);
- return (uint64_t)tv.tv_sec * 1000 + (uint64_t)tv.tv_usec;
-#endif
-}
-
-#ifdef WIN32
gcc_const
static unsigned
diff --git a/src/system/Clock.hxx b/src/system/Clock.hxx
index aa8587324..af4ed93b1 100644
--- a/src/system/Clock.hxx
+++ b/src/system/Clock.hxx
@@ -22,29 +22,6 @@
#include "Compiler.h"
-#include <stdint.h>
-
-/**
- * Returns the value of a monotonic clock in seconds.
- */
-gcc_pure
-unsigned
-MonotonicClockS();
-
-/**
- * Returns the value of a monotonic clock in milliseconds.
- */
-gcc_pure
-unsigned
-MonotonicClockMS();
-
-/**
- * Returns the value of a monotonic clock in microseconds.
- */
-gcc_pure
-uint64_t
-MonotonicClockUS();
-
#ifdef WIN32
/**