aboutsummaryrefslogtreecommitdiffstats
path: root/src/timers.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-29 00:03:19 +0000
committerlloyd <[email protected]>2008-09-29 00:03:19 +0000
commit8269e2897e0a652bbd949d38b74873976a98adeb (patch)
tree2ea103d5d7d4cf9073b4ac06cb5d5f7c62be16a6 /src/timers.cpp
parentab81a9d95264914ab34cb4e7134f827e3128c326 (diff)
Move timer base class into a module, add dep from other timer modules
Diffstat (limited to 'src/timers.cpp')
-rw-r--r--src/timers.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/timers.cpp b/src/timers.cpp
deleted file mode 100644
index 4f482916f..000000000
--- a/src/timers.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************
-* Timestamp Functions Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/timers.h>
-#include <botan/loadstor.h>
-#include <botan/util.h>
-#include <ctime>
-
-namespace Botan {
-
-/*************************************************
-* Get the system clock *
-*************************************************/
-u64bit system_time()
- {
- return static_cast<u64bit>(std::time(0));
- }
-
-/*************************************************
-* Default Timer clock reading *
-*************************************************/
-u64bit Timer::clock() const
- {
- return combine_timers(std::time(0), std::clock(), CLOCKS_PER_SEC);
- }
-
-/*************************************************
-* Read the clock and return the output *
-*************************************************/
-u32bit Timer::slow_poll(byte out[], u32bit length)
- {
- const u64bit clock_value = this->clock();
-
- for(u32bit j = 0; j != sizeof(clock_value); ++j)
- out[j % length] ^= get_byte(j, clock_value);
-
- return (length < 8) ? length : 8;
- }
-
-/*************************************************
-* Combine a two time values into a single one *
-*************************************************/
-u64bit Timer::combine_timers(u32bit seconds, u32bit parts, u32bit parts_hz)
- {
- static const u64bit NANOSECONDS_UNITS = 1000000000;
- parts *= (NANOSECONDS_UNITS / parts_hz);
- return ((seconds * NANOSECONDS_UNITS) + parts);
- }
-
-}