diff options
author | Chris Wilson <chris+github@qwirx.com> | 2012-11-17 00:54:04 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2012-11-17 00:54:04 +0000 |
commit | ea2f013734a6ff260c935181e4d194ee6bba8e9a (patch) | |
tree | aa892b15ec844c69f7964a88fae65a91d116eb25 | |
parent | 2c094f82ae5964b8b448634045576f145c370ca2 (diff) |
Fix timer miscalculation on Windows.
-rw-r--r-- | lib/common/BoxTime.h | 1 | ||||
-rw-r--r-- | lib/common/Timer.cpp | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/common/BoxTime.h b/lib/common/BoxTime.h index dfc40263..3108d809 100644 --- a/lib/common/BoxTime.h +++ b/lib/common/BoxTime.h @@ -18,6 +18,7 @@ typedef int64_t box_time_t; #define NANO_SEC_IN_USEC_LL (1000LL) #define MICRO_SEC_IN_SEC (1000000) #define MICRO_SEC_IN_SEC_LL (1000000LL) +#define MICRO_SEC_IN_MILLI_SEC (1000) #define MILLI_SEC_IN_SEC (1000) #define MILLI_SEC_IN_SEC_LL (1000LL) diff --git a/lib/common/Timer.cpp b/lib/common/Timer.cpp index 238860d6..cc82e4ab 100644 --- a/lib/common/Timer.cpp +++ b/lib/common/Timer.cpp @@ -364,7 +364,7 @@ Timer::Timer(size_t timeoutMillis, const std::string& rName) else { Timers::Add(*this); - Start(timeoutMillis * 1000); + Start(timeoutMillis); } } @@ -393,7 +393,7 @@ void Timer::Start() timeToExpiry = 1; } - Start(timeToExpiry); + Start(timeToExpiry / MICRO_SEC_IN_MILLI_SEC); #endif } @@ -430,6 +430,10 @@ void Timer::Start(int64_t timeoutMillis) GetErrorMessage(GetLastError())); mTimerHandle = INVALID_HANDLE_VALUE; } + else + { + BOX_INFO(TIMER_ID << "set for " << timeoutMillis << " ms"); + } #endif } |