summaryrefslogtreecommitdiff
path: root/hrtimer.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-18 02:34:33 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-18 02:34:33 +0000
commitdaec4644fb12b026eb5210827fe66cae3928635a (patch)
tree9732b0bb2e34535743af1bc3680de2ea8d013710 /hrtimer.h
parentecf8b8bd23401e833a901eb10ba06d0ab9482f88 (diff)
downloadcryptopp-daec4644fb12b026eb5210827fe66cae3928635a.tar.gz
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
Diffstat (limited to 'hrtimer.h')
-rw-r--r--hrtimer.h24
1 files changed, 15 insertions, 9 deletions
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