mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-26 15:08:03 +00:00
Fix stop watch for unix.
This commit is contained in:
parent
70674e5665
commit
588f58b237
3 changed files with 12 additions and 5 deletions
|
@ -19,6 +19,9 @@ ELSEIF( APPLE )
|
|||
SET( SOURCES ${SOURCES} "src/StopWatchOSX.cpp" )
|
||||
ELSE()
|
||||
SET( SOURCES ${SOURCES} "src/StopWatchUnix.cpp" )
|
||||
|
||||
# Assume compiler is GCC
|
||||
SET( LINK_FLAGS -lrt ${LINK_FLAGS} )
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/BPTCEncoder/include )
|
||||
|
@ -50,3 +53,7 @@ TARGET_LINK_LIBRARIES( TexCompCore BPTCEncoder )
|
|||
IF( Boost_FOUND )
|
||||
TARGET_LINK_LIBRARIES( TexCompCore ${Boost_LIBRARIES} )
|
||||
ENDIF()
|
||||
|
||||
IF( NOT WIN32 AND NOT APPLE )
|
||||
TARGET_LINK_LIBRARIES( TexCompCore rt )
|
||||
ENDIF()
|
||||
|
|
|
@ -23,7 +23,7 @@ StopWatch &StopWatch::operator=(const StopWatch &other) {
|
|||
delete impl;
|
||||
}
|
||||
impl = new StopWatchImpl();
|
||||
memcpy(impl, other.impl. sizeof(StopWatchImpl));
|
||||
memcpy(impl, other.impl, sizeof(StopWatchImpl));
|
||||
}
|
||||
|
||||
StopWatch::~StopWatch() {
|
||||
|
@ -36,17 +36,17 @@ StopWatch::StopWatch() : impl(new StopWatchImpl) {
|
|||
|
||||
void StopWatch::Start() {
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(impl->ts));
|
||||
impl->timer = double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec);
|
||||
impl->timer = double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec);
|
||||
}
|
||||
|
||||
void StopWatch::Stop() {
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(impl->ts));
|
||||
impl->duration = -(impl->timer) + (double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec));
|
||||
impl->duration = -(impl->timer) + (double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec));
|
||||
}
|
||||
|
||||
void StopWatch::Reset() {
|
||||
impl->timer = impl->duration = 0.0;
|
||||
memset(impl->ts, 0, sizeof(timespec));
|
||||
memset(&(impl->ts), 0, sizeof(timespec));
|
||||
}
|
||||
|
||||
double StopWatch::TimeInSeconds() const {
|
||||
|
|
|
@ -47,7 +47,7 @@ StopWatch &StopWatch::operator=(const StopWatch &other) {
|
|||
delete impl;
|
||||
}
|
||||
impl = new StopWatchImpl();
|
||||
memcpy(impl, other.impl. sizeof(StopWatchImpl));
|
||||
memcpy(impl, other.impl, sizeof(StopWatchImpl));
|
||||
}
|
||||
|
||||
StopWatch::~StopWatch() {
|
||||
|
|
Loading…
Reference in a new issue