mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
Use boost::chrono instead of std::chrono
This commit is contained in:
@@ -173,11 +173,10 @@ message(STATUS "Build revision: ${BUILD_REVISION}")
|
||||
add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")
|
||||
|
||||
# find boost
|
||||
set(REQUIRED_BOOST_COMPONENTS locale system filesystem regex thread)
|
||||
set(REQUIRED_BOOST_COMPONENTS locale system filesystem regex thread chrono)
|
||||
if(WIN32)
|
||||
set(Boost_THREADAPI win32)
|
||||
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DBOOST_THREAD_USE_LIB) # fix boost thread linkage
|
||||
set(REQUIRED_BOOST_COMPONENTS ${REQUIRED_BOOST_COMPONENTS} chrono) # mingw32 does not have std::thread
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_LIBS ${USE_STATIC_LIBS})
|
||||
|
@@ -21,19 +21,19 @@
|
||||
*/
|
||||
|
||||
#include "time.h"
|
||||
#include <chrono>
|
||||
#include <boost/chrono.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace stdext {
|
||||
|
||||
const static auto startup_time = std::chrono::high_resolution_clock::now();
|
||||
const static auto startup_time = boost::chrono::high_resolution_clock::now();
|
||||
|
||||
ticks_t millis()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - startup_time).count();
|
||||
return boost::chrono::duration_cast<boost::chrono::milliseconds>(boost::chrono::high_resolution_clock::now() - startup_time).count();
|
||||
}
|
||||
ticks_t micros() {
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - startup_time).count();
|
||||
return boost::chrono::duration_cast<boost::chrono::microseconds>(boost::chrono::high_resolution_clock::now() - startup_time).count();
|
||||
}
|
||||
|
||||
void millisleep(size_t ms)
|
||||
|
Reference in New Issue
Block a user