aboutsummaryrefslogtreecommitdiffstats
path: root/modules/timer/gettimeofday/tm_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/timer/gettimeofday/tm_unix.cpp')
-rw-r--r--modules/timer/gettimeofday/tm_unix.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/timer/gettimeofday/tm_unix.cpp b/modules/timer/gettimeofday/tm_unix.cpp
new file mode 100644
index 000000000..654297753
--- /dev/null
+++ b/modules/timer/gettimeofday/tm_unix.cpp
@@ -0,0 +1,22 @@
+/*************************************************
+* Unix Timer Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/tm_unix.h>
+#include <botan/util.h>
+#include <sys/time.h>
+
+namespace Botan {
+
+/*************************************************
+* Get the timestamp *
+*************************************************/
+u64bit Unix_Timer::clock() const
+ {
+ struct ::timeval tv;
+ ::gettimeofday(&tv, 0);
+ return combine_timers(tv.tv_sec, tv.tv_usec, 1000000);
+ }
+
+}