diff options
Diffstat (limited to 'src/timer/gettimeofday')
-rw-r--r-- | src/timer/gettimeofday/modinfo.txt | 27 | ||||
-rw-r--r-- | src/timer/gettimeofday/tm_unix.cpp | 22 | ||||
-rw-r--r-- | src/timer/gettimeofday/tm_unix.h | 24 |
3 files changed, 73 insertions, 0 deletions
diff --git a/src/timer/gettimeofday/modinfo.txt b/src/timer/gettimeofday/modinfo.txt new file mode 100644 index 000000000..495914589 --- /dev/null +++ b/src/timer/gettimeofday/modinfo.txt @@ -0,0 +1,27 @@ +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 +hpux +irix +linux +netbsd +openbsd +qnx +solaris +tru64 +</os> diff --git a/src/timer/gettimeofday/tm_unix.cpp b/src/timer/gettimeofday/tm_unix.cpp new file mode 100644 index 000000000..654297753 --- /dev/null +++ b/src/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); + } + +} diff --git a/src/timer/gettimeofday/tm_unix.h b/src/timer/gettimeofday/tm_unix.h new file mode 100644 index 000000000..fd24a1563 --- /dev/null +++ b/src/timer/gettimeofday/tm_unix.h @@ -0,0 +1,24 @@ +/************************************************* +* Unix Timer Header File * +* (C) 1999-2007 Jack Lloyd * +*************************************************/ + +#ifndef BOTAN_TIMER_UNIX_H__ +#define BOTAN_TIMER_UNIX_H__ + +#include <botan/timers.h> + +namespace Botan { + +/************************************************* +* Unix Timer * +*************************************************/ +class Unix_Timer : public Timer + { + public: + u64bit clock() const; + }; + +} + +#endif |