aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tm_unix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tm_unix')
-rw-r--r--modules/tm_unix/modinfo.txt22
-rw-r--r--modules/tm_unix/tm_unix.cpp22
-rw-r--r--modules/tm_unix/tm_unix.h24
3 files changed, 68 insertions, 0 deletions
diff --git a/modules/tm_unix/modinfo.txt b/modules/tm_unix/modinfo.txt
new file mode 100644
index 000000000..78400fbc9
--- /dev/null
+++ b/modules/tm_unix/modinfo.txt
@@ -0,0 +1,22 @@
+realname "Unix Timer"
+
+define TIMER_UNIX
+
+add_file tm_unix.cpp
+add_file tm_unix.h
+
+<os>
+aix
+beos
+cygwin
+darwin
+freebsd
+hpux
+irix
+linux
+netbsd
+openbsd
+qnx
+solaris
+tru64
+</os>
diff --git a/modules/tm_unix/tm_unix.cpp b/modules/tm_unix/tm_unix.cpp
new file mode 100644
index 000000000..3cf6928be
--- /dev/null
+++ b/modules/tm_unix/tm_unix.cpp
@@ -0,0 +1,22 @@
+/*************************************************
+* Unix Timer Source File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#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);
+ }
+
+}
diff --git a/modules/tm_unix/tm_unix.h b/modules/tm_unix/tm_unix.h
new file mode 100644
index 000000000..2c14cb2d0
--- /dev/null
+++ b/modules/tm_unix/tm_unix.h
@@ -0,0 +1,24 @@
+/*************************************************
+* Unix Timer Header File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#ifndef BOTAN_EXT_TIMER_UNIX_H__
+#define BOTAN_EXT_TIMER_UNIX_H__
+
+#include <botan/timers.h>
+
+namespace Botan {
+
+/*************************************************
+* Unix Timer *
+*************************************************/
+class Unix_Timer : public Timer
+ {
+ public:
+ u64bit clock() const;
+ };
+
+}
+
+#endif