Changed time function name to reflect that it actually returns Microseconds as reported in #323

This commit is contained in:
Phil Nash 2014-09-03 19:20:23 +01:00
parent ee5e7ed2c9
commit fcf5ef0db6
2 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ namespace Catch {
public: public:
Timer() : m_ticks( 0 ) {} Timer() : m_ticks( 0 ) {}
void start(); void start();
unsigned int getElapsedNanoseconds() const; unsigned int getElapsedMicroseconds() const;
unsigned int getElapsedMilliseconds() const; unsigned int getElapsedMilliseconds() const;
double getElapsedSeconds() const; double getElapsedSeconds() const;

View File

@ -46,14 +46,14 @@ namespace Catch {
void Timer::start() { void Timer::start() {
m_ticks = getCurrentTicks(); m_ticks = getCurrentTicks();
} }
unsigned int Timer::getElapsedNanoseconds() const { unsigned int Timer::getElapsedMicroseconds() const {
return static_cast<unsigned int>(getCurrentTicks() - m_ticks); return static_cast<unsigned int>(getCurrentTicks() - m_ticks);
} }
unsigned int Timer::getElapsedMilliseconds() const { unsigned int Timer::getElapsedMilliseconds() const {
return static_cast<unsigned int>((getCurrentTicks() - m_ticks)/1000); return static_cast<unsigned int>(getElapsedMicroseconds()/1000);
} }
double Timer::getElapsedSeconds() const { double Timer::getElapsedSeconds() const {
return (getCurrentTicks() - m_ticks)/1000000.0; return getElapsedMicroseconds()/1000000.0;
} }
} // namespace Catch } // namespace Catch