aboutsummaryrefslogtreecommitdiffstats
path: root/Attic/timer/gettimeofday
diff options
context:
space:
mode:
Diffstat (limited to 'Attic/timer/gettimeofday')
-rw-r--r--Attic/timer/gettimeofday/info.txt33
-rw-r--r--Attic/timer/gettimeofday/tm_unix.cpp23
-rw-r--r--Attic/timer/gettimeofday/tm_unix.h27
3 files changed, 83 insertions, 0 deletions
diff --git a/Attic/timer/gettimeofday/info.txt b/Attic/timer/gettimeofday/info.txt
new file mode 100644
index 000000000..a58e8088d
--- /dev/null
+++ b/Attic/timer/gettimeofday/info.txt
@@ -0,0 +1,33 @@
+realname "Unix Timer"
+
+define TIMER_UNIX
+
+load_on auto
+modset unix,beos
+
+<add>
+tm_unix.cpp
+tm_unix.h
+</add>
+
+<os>
+aix
+beos
+cygwin
+darwin
+freebsd
+dragonfly
+hpux
+irix
+linux
+netbsd
+openbsd
+qnx
+solaris
+tru64
+</os>
+
+<requires>
+timer
+</requires>
+
diff --git a/Attic/timer/gettimeofday/tm_unix.cpp b/Attic/timer/gettimeofday/tm_unix.cpp
new file mode 100644
index 000000000..9d8ac4a04
--- /dev/null
+++ b/Attic/timer/gettimeofday/tm_unix.cpp
@@ -0,0 +1,23 @@
+/*
+* Unix Timer
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/tm_unix.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/Attic/timer/gettimeofday/tm_unix.h b/Attic/timer/gettimeofday/tm_unix.h
new file mode 100644
index 000000000..c304dbb5c
--- /dev/null
+++ b/Attic/timer/gettimeofday/tm_unix.h
@@ -0,0 +1,27 @@
+/*
+* Unix Timer
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_TIMER_UNIX_H__
+#define BOTAN_TIMER_UNIX_H__
+
+#include <botan/timer.h>
+
+namespace Botan {
+
+/*
+* Unix Timer
+*/
+class BOTAN_DLL Unix_Timer : public Timer
+ {
+ public:
+ std::string name() const { return "Unix gettimeofday"; }
+ u64bit clock() const;
+ };
+
+}
+
+#endif