diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-01-10 02:40:12 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-01-10 02:40:12 (GMT) |
commit | 613cf9fb6fe4b24bc7852d5a31953f6ff419e43c (patch) | |
tree | 8459365c5a6a00503063b0bf1d516fce5ea4d891 /src/uscxml/concurrency/Timer.h | |
parent | c699a4057a65a9a09f78310d8e12588f2dc072cd (diff) | |
download | uscxml-613cf9fb6fe4b24bc7852d5a31953f6ff419e43c.zip uscxml-613cf9fb6fe4b24bc7852d5a31953f6ff419e43c.tar.gz uscxml-613cf9fb6fe4b24bc7852d5a31953f6ff419e43c.tar.bz2 |
Beautified code
Diffstat (limited to 'src/uscxml/concurrency/Timer.h')
-rw-r--r-- | src/uscxml/concurrency/Timer.h | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/uscxml/concurrency/Timer.h b/src/uscxml/concurrency/Timer.h index 217f68f..1ecfeb2 100644 --- a/src/uscxml/concurrency/Timer.h +++ b/src/uscxml/concurrency/Timer.h @@ -18,56 +18,56 @@ namespace uscxml { class USCXML_API Timer { public: - - static double monotonic_seconds(); - - Timer() { - invocations = 0; - elapsed = 0; - } - - void start() { - if (invocations == 0) { - started = monotonic_seconds(); - } - invocations++; - } - - void reset() { - elapsed = 0; + + static double monotonic_seconds(); + + Timer() { + invocations = 0; + elapsed = 0; + } + + void start() { + if (invocations == 0) { + started = monotonic_seconds(); } - - void stop() { - if (invocations == 0) - return; - - invocations--; - if (invocations == 0) { - elapsed += monotonic_seconds() - started; - } - } - - ~Timer() { - } - double elapsed; + invocations++; + } + + void reset() { + elapsed = 0; + } + + void stop() { + if (invocations == 0) + return; + + invocations--; + if (invocations == 0) { + elapsed += monotonic_seconds() - started; + } + } + + ~Timer() { + } + double elapsed; protected: - size_t invocations; - double started; + size_t invocations; + double started; }; - + class USCXML_API Measurement { public: - Measurement(Timer* timer) : timer(timer) { - timer->start(); - } + Measurement(Timer* timer) : timer(timer) { + timer->start(); + } - ~Measurement() { - timer->stop(); - } + ~Measurement() { + timer->stop(); + } protected: - Timer* timer; + Timer* timer; }; } |