diff options
author | Chris Wilson <chris+github@qwirx.com> | 2011-01-12 00:09:16 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2011-01-12 00:09:16 +0000 |
commit | ff316251a1b9f169dcb39227c0229c709f3be77d (patch) | |
tree | 7a8f81d803a89b2f83343e8a924617785589eb33 /lib/common/BoxTime.h | |
parent | ac658b0659c90ef72e937d5fb104d3e52f9aa634 (diff) |
Move accurate sleep code from Test.cpp to BoxTime, allow requesting times
in microseconds with ShortSleep(), make safe_sleep() use it.
Rename MILLI_SEC_IN_NANO_SEC to MILLI_SEC_IN_SEC which is what it actually is.
Diffstat (limited to 'lib/common/BoxTime.h')
-rw-r--r-- | lib/common/BoxTime.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/common/BoxTime.h b/lib/common/BoxTime.h index 6681bbbd..a56f39f1 100644 --- a/lib/common/BoxTime.h +++ b/lib/common/BoxTime.h @@ -18,8 +18,8 @@ typedef uint64_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 MILLI_SEC_IN_NANO_SEC (1000) -#define MILLI_SEC_IN_NANO_SEC_LL (1000LL) +#define MILLI_SEC_IN_SEC (1000) +#define MILLI_SEC_IN_SEC_LL (1000LL) box_time_t GetCurrentBoxTime(); @@ -33,7 +33,7 @@ inline time_t BoxTimeToSeconds(box_time_t Time) } inline uint64_t BoxTimeToMilliSeconds(box_time_t Time) { - return Time / MILLI_SEC_IN_NANO_SEC_LL; + return Time / MILLI_SEC_IN_SEC_LL; } inline uint64_t BoxTimeToMicroSeconds(box_time_t Time) { @@ -43,4 +43,6 @@ inline uint64_t BoxTimeToMicroSeconds(box_time_t Time) std::string FormatTime(box_time_t time, bool includeDate, bool showMicros = false); +void ShortSleep(box_time_t duration, bool logDuration); + #endif // BOXTIME__H |