summaryrefslogtreecommitdiff
path: root/hrtimer.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:04:58 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:04:58 +0000
commitcdd57fd49c847250ce5d8e3cc39b7d882a529fc3 (patch)
treeaf7086b6bdb722b9a90c1abe0dd994166f32040b /hrtimer.h
parent061bcd669cf286d0043e1060bb36761df2df907e (diff)
downloadcryptopp-cdd57fd49c847250ce5d8e3cc39b7d882a529fc3.tar.gz
reduce risk of random number reuse after VM rollback
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@328 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'hrtimer.h')
-rw-r--r--hrtimer.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/hrtimer.h b/hrtimer.h
index 03c4310..6bb8301 100644
--- a/hrtimer.h
+++ b/hrtimer.h
@@ -5,14 +5,19 @@
NAMESPACE_BEGIN(CryptoPP)
-#ifdef WORD64_AVAILABLE
- typedef word64 TimerWord;
+#ifdef HIGHRES_TIMER_AVAILABLE
+ #ifdef WORD64_AVAILABLE
+ typedef word64 TimerWord;
+ #else
+ typedef word32 TimerWord;
+ #endif
#else
- typedef word32 TimerWord;
+ #include <time.h>
+ typedef clock_t TimerWord;
#endif
//! _
-class TimerBase
+class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TimerBase
{
public:
enum Unit {SECONDS = 0, MILLISECONDS, MICROSECONDS, NANOSECONDS};
@@ -44,10 +49,8 @@ public:
TimerWord TicksPerSecond();
};
-#ifdef HIGHRES_TIMER_AVAILABLE
-
//! high resolution timer
-class Timer : public TimerBase
+class CRYPTOPP_DLL Timer : public TimerBase
{
public:
Timer(Unit unit = TimerBase::SECONDS, bool stuckAtZero = false) : TimerBase(unit, stuckAtZero) {}
@@ -55,8 +58,6 @@ public:
TimerWord TicksPerSecond();
};
-#endif // HIGHRES_TIMER_AVAILABLE
-
NAMESPACE_END
#endif