diff options
author | Chris Wilson <chris+github@qwirx.com> | 2012-11-06 23:57:03 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2012-11-06 23:57:03 +0000 |
commit | cb0a6924b984678f1b7a2db92a897a0f99b8c96a (patch) | |
tree | 8f4854a38d838017eda8aae4f97249bfddef666e /lib/common | |
parent | c24770d99f2ec5bf18c035a1ff97c48c32442d32 (diff) |
Convert FORMAT_MICROSECONDS into a global utility macro.
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/Logging.h | 4 | ||||
-rw-r--r-- | lib/common/Timer.cpp | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h index 2318e142..1fb4b353 100644 --- a/lib/common/Logging.h +++ b/lib/common/Logging.h @@ -144,6 +144,10 @@ std::setw(6) << \ timespec.tv_usec +#define BOX_FORMAT_MICROSECONDS(t) \ + (int)((t) / 1000000) << "." << \ + (int)((t) % 1000000) << " seconds" + #undef ERROR namespace Log diff --git a/lib/common/Timer.cpp b/lib/common/Timer.cpp index 81a4dd80..106b6b37 100644 --- a/lib/common/Timer.cpp +++ b/lib/common/Timer.cpp @@ -170,10 +170,6 @@ void Timers::RescheduleIfNeeded() } } -#define FORMAT_MICROSECONDS(t) \ - (int)(t / 1000000) << "." << \ - (int)(t % 1000000) << " seconds" - // -------------------------------------------------------------------------- // // Function @@ -242,7 +238,7 @@ void Timers::Reschedule() */ BOX_TRACE(TIMER_ID_OF(**i) "has expired, " "triggering " << - FORMAT_MICROSECONDS(-timeToExpiry) << + BOX_FORMAT_MICROSECONDS(-timeToExpiry) << " late"); rTimer.OnExpire(); spTimers->erase(i); @@ -295,7 +291,7 @@ void Timers::Reschedule() else { BOX_TRACE("timer: next event: " << nameOfNextEvent << - " expires in " << FORMAT_MICROSECONDS(timeToNextEvent)); + " expires in " << BOX_FORMAT_MICROSECONDS(timeToNextEvent)); } struct itimerval timeout; @@ -397,7 +393,7 @@ void Timer::Start() if (timeToExpiry <= 0) { BOX_WARNING(TIMER_ID << "fudging expiry from -" << - FORMAT_MICROSECONDS(-timeToExpiry)) + BOX_FORMAT_MICROSECONDS(-timeToExpiry)) timeToExpiry = 1; } |