From bde99d684e0bb51adaa053a240abe61cf4af07fb Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 20 Oct 2014 18:59:40 +0100 Subject: Migrated cSleep and cTimer to std::chrono --- src/OSSupport/CMakeLists.txt | 2 -- src/OSSupport/IsThread.h | 2 +- src/OSSupport/Sleep.cpp | 19 ------------------- src/OSSupport/Sleep.h | 7 ------- src/OSSupport/Timer.cpp | 37 ------------------------------------- src/OSSupport/Timer.h | 32 -------------------------------- 6 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 src/OSSupport/Sleep.cpp delete mode 100644 src/OSSupport/Sleep.h delete mode 100644 src/OSSupport/Timer.cpp delete mode 100644 src/OSSupport/Timer.h (limited to 'src/OSSupport') diff --git a/src/OSSupport/CMakeLists.txt b/src/OSSupport/CMakeLists.txt index 1c8da5ddd..45df0c1a3 100644 --- a/src/OSSupport/CMakeLists.txt +++ b/src/OSSupport/CMakeLists.txt @@ -13,7 +13,6 @@ SET (SRCS IsThread.cpp ListenThread.cpp Semaphore.cpp - Sleep.cpp Socket.cpp SocketThreads.cpp Timer.cpp) @@ -28,7 +27,6 @@ SET (HDRS ListenThread.h Queue.h Semaphore.h - Sleep.h Socket.h SocketThreads.h Timer.h) diff --git a/src/OSSupport/IsThread.h b/src/OSSupport/IsThread.h index 8dfad84cb..ba6a48898 100644 --- a/src/OSSupport/IsThread.h +++ b/src/OSSupport/IsThread.h @@ -33,7 +33,7 @@ protected: volatile bool m_ShouldTerminate; public: - cIsThread(const AString & iThreadName); + cIsThread(const AString & a_ThreadName); virtual ~cIsThread(); /// Starts the thread; returns without waiting for the actual start diff --git a/src/OSSupport/Sleep.cpp b/src/OSSupport/Sleep.cpp deleted file mode 100644 index 297d668d7..000000000 --- a/src/OSSupport/Sleep.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#ifndef _WIN32 - #include -#endif - - - - - -void cSleep::MilliSleep( unsigned int a_MilliSeconds) -{ -#ifdef _WIN32 - Sleep(a_MilliSeconds); // Don't tick too much -#else - usleep(a_MilliSeconds*1000); -#endif -} diff --git a/src/OSSupport/Sleep.h b/src/OSSupport/Sleep.h deleted file mode 100644 index 57d29682c..000000000 --- a/src/OSSupport/Sleep.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -class cSleep -{ -public: - static void MilliSleep( unsigned int a_MilliSeconds); -}; diff --git a/src/OSSupport/Timer.cpp b/src/OSSupport/Timer.cpp deleted file mode 100644 index fd838dd0d..000000000 --- a/src/OSSupport/Timer.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Timer.h" - - - - - - -cTimer::cTimer(void) -{ - #ifdef _WIN32 - QueryPerformanceFrequency(&m_TicksPerSecond); - #endif -} - - - - - -long long cTimer::GetNowTime(void) -{ - #ifdef _WIN32 - LARGE_INTEGER now; - QueryPerformanceCounter(&now); - return ((now.QuadPart * 1000) / m_TicksPerSecond.QuadPart); - #else - struct timeval now; - gettimeofday(&now, NULL); - return (long long)now.tv_sec * 1000 + (long long)now.tv_usec / 1000; - #endif -} - - - - diff --git a/src/OSSupport/Timer.h b/src/OSSupport/Timer.h deleted file mode 100644 index a059daa41..000000000 --- a/src/OSSupport/Timer.h +++ /dev/null @@ -1,32 +0,0 @@ - -// Timer.h - -// Declares the cTimer class representing an OS-independent of retrieving current time with msec accuracy - - - - - -#pragma once - - - - - -class cTimer -{ -public: - cTimer(void); - - // Returns the current time expressed in milliseconds - long long GetNowTime(void); -private: - - #ifdef _WIN32 - LARGE_INTEGER m_TicksPerSecond; - #endif -} ; - - - - -- cgit v1.2.3