aboutsummaryrefslogtreecommitdiffstats
path: root/Attic/timer/gettimeofday
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-11-02 12:12:40 +0000
committerlloyd <[email protected]>2009-11-02 12:12:40 +0000
commitb8658279904708d0690e473fb85942d5da23d2fc (patch)
tree65528378bd0089287ca0927a13a6e0a012f7bc78 /Attic/timer/gettimeofday
parent6b617a55bd02bcc4fdb6f76af92e0cb65fd838a2 (diff)
parent92f31b22dfe2aa1b2bde84cbaf4ce7365fa4ec68 (diff)
propagate from branch 'net.randombit.botan' (head 2773c2310e8c0a51975987a2dd6c5824c8d43882)
to branch 'net.randombit.botan.c++0x' (head f13cf5d7e89706c882604299b508f356c20aae3a)
Diffstat (limited to 'Attic/timer/gettimeofday')
-rw-r--r--Attic/timer/gettimeofday/info.txt30
-rw-r--r--Attic/timer/gettimeofday/tm_unix.cpp23
-rw-r--r--Attic/timer/gettimeofday/tm_unix.h27
3 files changed, 80 insertions, 0 deletions
diff --git a/Attic/timer/gettimeofday/info.txt b/Attic/timer/gettimeofday/info.txt
new file mode 100644
index 000000000..f8b65b4ba
--- /dev/null
+++ b/Attic/timer/gettimeofday/info.txt
@@ -0,0 +1,30 @@
+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