diff options
Diffstat (limited to 'src/timer')
-rw-r--r-- | src/timer/cpu_counter/info.txt | 2 | ||||
-rw-r--r-- | src/timer/gettimeofday/info.txt | 3 | ||||
-rw-r--r-- | src/timer/gettimeofday/tm_unix.cpp | 1 | ||||
-rw-r--r-- | src/timer/info.txt | 2 | ||||
-rw-r--r-- | src/timer/posix_rt/info.txt | 3 | ||||
-rw-r--r-- | src/timer/posix_rt/tm_posix.cpp | 1 | ||||
-rw-r--r-- | src/timer/timer.cpp | 14 | ||||
-rw-r--r-- | src/timer/timer.h | 8 | ||||
-rw-r--r-- | src/timer/win32_query_perf_ctr/info.txt | 3 |
9 files changed, 21 insertions, 16 deletions
diff --git a/src/timer/cpu_counter/info.txt b/src/timer/cpu_counter/info.txt index 025663a84..d95e0fec5 100644 --- a/src/timer/cpu_counter/info.txt +++ b/src/timer/cpu_counter/info.txt @@ -1,5 +1,3 @@ -realname "Hardware Timer" - define TIMER_HARDWARE load_on asm_ok diff --git a/src/timer/gettimeofday/info.txt b/src/timer/gettimeofday/info.txt index a58e8088d..f8b65b4ba 100644 --- a/src/timer/gettimeofday/info.txt +++ b/src/timer/gettimeofday/info.txt @@ -1,5 +1,3 @@ -realname "Unix Timer" - define TIMER_UNIX load_on auto @@ -30,4 +28,3 @@ tru64 <requires> timer </requires> - diff --git a/src/timer/gettimeofday/tm_unix.cpp b/src/timer/gettimeofday/tm_unix.cpp index e32df7166..9d8ac4a04 100644 --- a/src/timer/gettimeofday/tm_unix.cpp +++ b/src/timer/gettimeofday/tm_unix.cpp @@ -6,7 +6,6 @@ */ #include <botan/tm_unix.h> -#include <botan/util.h> #include <sys/time.h> namespace Botan { diff --git a/src/timer/info.txt b/src/timer/info.txt index 6408dca45..1dff5ab6f 100644 --- a/src/timer/info.txt +++ b/src/timer/info.txt @@ -1,5 +1,3 @@ -realname "Timer Base Class" - define TIMER load_on auto diff --git a/src/timer/posix_rt/info.txt b/src/timer/posix_rt/info.txt index fa530ea1a..4b23a74fc 100644 --- a/src/timer/posix_rt/info.txt +++ b/src/timer/posix_rt/info.txt @@ -1,5 +1,3 @@ -realname "POSIX Timer" - define TIMER_POSIX load_on auto @@ -26,4 +24,3 @@ dragonfly <requires> timer </requires> - diff --git a/src/timer/posix_rt/tm_posix.cpp b/src/timer/posix_rt/tm_posix.cpp index d356384ab..96182025c 100644 --- a/src/timer/posix_rt/tm_posix.cpp +++ b/src/timer/posix_rt/tm_posix.cpp @@ -6,7 +6,6 @@ */ #include <botan/tm_posix.h> -#include <botan/util.h> #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199309 diff --git a/src/timer/timer.cpp b/src/timer/timer.cpp index 035c217f9..16d7dc368 100644 --- a/src/timer/timer.cpp +++ b/src/timer/timer.cpp @@ -7,7 +7,6 @@ #include <botan/timer.h> #include <botan/loadstor.h> -#include <botan/util.h> #include <ctime> namespace Botan { @@ -20,6 +19,19 @@ u64bit system_time() return static_cast<u64bit>(std::time(0)); } +/* +* Convert a time_t to a struct tm +*/ +std::tm time_t_to_tm(u64bit timer) + { + std::time_t time_val = static_cast<std::time_t>(timer); + + std::tm* tm_p = std::gmtime(&time_val); + if (tm_p == 0) + throw Encoding_Error("time_t_to_tm could not convert"); + return (*tm_p); + } + /** * Read the clock and return the output */ diff --git a/src/timer/timer.h b/src/timer/timer.h index b6e8ef448..603027f6d 100644 --- a/src/timer/timer.h +++ b/src/timer/timer.h @@ -9,9 +9,17 @@ #define BOTAN_TIMERS_H__ #include <botan/rng.h> +#include <ctime> namespace Botan { +/* +* Time Access/Conversion Functions +*/ +BOTAN_DLL u64bit system_time(); + +BOTAN_DLL std::tm time_t_to_tm(u64bit); + /** * Timer Interface */ diff --git a/src/timer/win32_query_perf_ctr/info.txt b/src/timer/win32_query_perf_ctr/info.txt index 4bb1ddb34..d8611027a 100644 --- a/src/timer/win32_query_perf_ctr/info.txt +++ b/src/timer/win32_query_perf_ctr/info.txt @@ -1,5 +1,3 @@ -realname "Win32 Timer" - define TIMER_WIN32 modset win32 @@ -23,4 +21,3 @@ windows -> user32.lib <requires> timer </requires> - |