From daec4644fb12b026eb5210827fe66cae3928635a Mon Sep 17 00:00:00 2001 From: weidai Date: Mon, 18 Dec 2006 02:34:33 +0000 Subject: update version number, port to Sun C++ 5.8 git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@265 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- hrtimer.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'hrtimer.h') diff --git a/hrtimer.h b/hrtimer.h index a6a96df..03c4310 100644 --- a/hrtimer.h +++ b/hrtimer.h @@ -5,6 +5,12 @@ NAMESPACE_BEGIN(CryptoPP) +#ifdef WORD64_AVAILABLE + typedef word64 TimerWord; +#else + typedef word32 TimerWord; +#endif + //! _ class TimerBase { @@ -12,19 +18,19 @@ public: enum Unit {SECONDS = 0, MILLISECONDS, MICROSECONDS, NANOSECONDS}; TimerBase(Unit unit, bool stuckAtZero) : m_timerUnit(unit), m_stuckAtZero(stuckAtZero), m_started(false) {} - virtual word64 GetCurrentTimerValue() =0; // GetCurrentTime is a macro in MSVC 6.0 - virtual word64 TicksPerSecond() =0; // this is not the resolution, just a conversion factor into seconds + virtual TimerWord GetCurrentTimerValue() =0; // GetCurrentTime is a macro in MSVC 6.0 + virtual TimerWord TicksPerSecond() =0; // this is not the resolution, just a conversion factor into seconds void StartTimer(); double ElapsedTimeAsDouble(); unsigned long ElapsedTime(); private: - double ConvertTo(word64 t, Unit unit); + double ConvertTo(TimerWord t, Unit unit); Unit m_timerUnit; // HPUX workaround: m_unit is a system macro on HPUX bool m_stuckAtZero, m_started; - word64 m_start, m_last; + TimerWord m_start, m_last; }; //! measure CPU time spent executing instructions of this thread (if supported by OS) @@ -34,8 +40,8 @@ class ThreadUserTimer : public TimerBase { public: ThreadUserTimer(Unit unit = TimerBase::SECONDS, bool stuckAtZero = false) : TimerBase(unit, stuckAtZero) {} - word64 GetCurrentTimerValue(); - word64 TicksPerSecond(); + TimerWord GetCurrentTimerValue(); + TimerWord TicksPerSecond(); }; #ifdef HIGHRES_TIMER_AVAILABLE @@ -45,11 +51,11 @@ class Timer : public TimerBase { public: Timer(Unit unit = TimerBase::SECONDS, bool stuckAtZero = false) : TimerBase(unit, stuckAtZero) {} - word64 GetCurrentTimerValue(); - word64 TicksPerSecond(); + TimerWord GetCurrentTimerValue(); + TimerWord TicksPerSecond(); }; -#endif +#endif // HIGHRES_TIMER_AVAILABLE NAMESPACE_END -- cgit v1.2.1