diff options
-rw-r--r-- | Attic/timer/cpu_counter/info.txt (renamed from src/timer/cpu_counter/info.txt) | 0 | ||||
-rw-r--r-- | Attic/timer/cpu_counter/tm_hard.cpp (renamed from src/timer/cpu_counter/tm_hard.cpp) | 0 | ||||
-rw-r--r-- | Attic/timer/cpu_counter/tm_hard.h (renamed from src/timer/cpu_counter/tm_hard.h) | 0 | ||||
-rw-r--r-- | Attic/timer/gettimeofday/info.txt (renamed from src/timer/gettimeofday/info.txt) | 0 | ||||
-rw-r--r-- | Attic/timer/gettimeofday/tm_unix.cpp (renamed from src/timer/gettimeofday/tm_unix.cpp) | 0 | ||||
-rw-r--r-- | Attic/timer/gettimeofday/tm_unix.h (renamed from src/timer/gettimeofday/tm_unix.h) | 0 | ||||
-rw-r--r-- | Attic/timer/info.txt (renamed from src/timer/info.txt) | 0 | ||||
-rw-r--r-- | Attic/timer/posix_rt/info.txt (renamed from src/timer/posix_rt/info.txt) | 0 | ||||
-rw-r--r-- | Attic/timer/posix_rt/tm_posix.cpp (renamed from src/timer/posix_rt/tm_posix.cpp) | 0 | ||||
-rw-r--r-- | Attic/timer/posix_rt/tm_posix.h (renamed from src/timer/posix_rt/tm_posix.h) | 0 | ||||
-rw-r--r-- | Attic/timer/timer.cpp (renamed from src/timer/timer.cpp) | 0 | ||||
-rw-r--r-- | Attic/timer/timer.h (renamed from src/timer/timer.h) | 0 | ||||
-rw-r--r-- | Attic/timer/win32_query_perf_ctr/info.txt (renamed from src/timer/win32_query_perf_ctr/info.txt) | 0 | ||||
-rw-r--r-- | Attic/timer/win32_query_perf_ctr/tm_win32.cpp (renamed from src/timer/win32_query_perf_ctr/tm_win32.cpp) | 0 | ||||
-rw-r--r-- | Attic/timer/win32_query_perf_ctr/tm_win32.h (renamed from src/timer/win32_query_perf_ctr/tm_win32.h) | 0 | ||||
-rw-r--r-- | checks/cvc_tests.cpp | 2 | ||||
-rw-r--r-- | src/asn1/asn1_tm.cpp | 2 | ||||
-rw-r--r-- | src/cert/cvc/asn1_eac_tm.cpp | 2 | ||||
-rw-r--r-- | src/cert/cvc/cvc_self.cpp | 2 | ||||
-rw-r--r-- | src/cert/x509/crl_ent.cpp | 2 | ||||
-rw-r--r-- | src/cert/x509/x509_ca.cpp | 2 | ||||
-rw-r--r-- | src/cert/x509/x509opt.cpp | 2 | ||||
-rw-r--r-- | src/cert/x509/x509stor.cpp | 2 | ||||
-rw-r--r-- | src/rng/auto_rng/info.txt | 1 | ||||
-rw-r--r-- | src/utils/time.h | 39 |
25 files changed, 47 insertions, 9 deletions
diff --git a/src/timer/cpu_counter/info.txt b/Attic/timer/cpu_counter/info.txt index 025663a84..025663a84 100644 --- a/src/timer/cpu_counter/info.txt +++ b/Attic/timer/cpu_counter/info.txt diff --git a/src/timer/cpu_counter/tm_hard.cpp b/Attic/timer/cpu_counter/tm_hard.cpp index 9e31aee39..9e31aee39 100644 --- a/src/timer/cpu_counter/tm_hard.cpp +++ b/Attic/timer/cpu_counter/tm_hard.cpp diff --git a/src/timer/cpu_counter/tm_hard.h b/Attic/timer/cpu_counter/tm_hard.h index 2e338eca8..2e338eca8 100644 --- a/src/timer/cpu_counter/tm_hard.h +++ b/Attic/timer/cpu_counter/tm_hard.h diff --git a/src/timer/gettimeofday/info.txt b/Attic/timer/gettimeofday/info.txt index a58e8088d..a58e8088d 100644 --- a/src/timer/gettimeofday/info.txt +++ b/Attic/timer/gettimeofday/info.txt diff --git a/src/timer/gettimeofday/tm_unix.cpp b/Attic/timer/gettimeofday/tm_unix.cpp index 9d8ac4a04..9d8ac4a04 100644 --- a/src/timer/gettimeofday/tm_unix.cpp +++ b/Attic/timer/gettimeofday/tm_unix.cpp diff --git a/src/timer/gettimeofday/tm_unix.h b/Attic/timer/gettimeofday/tm_unix.h index c304dbb5c..c304dbb5c 100644 --- a/src/timer/gettimeofday/tm_unix.h +++ b/Attic/timer/gettimeofday/tm_unix.h diff --git a/src/timer/info.txt b/Attic/timer/info.txt index 6408dca45..6408dca45 100644 --- a/src/timer/info.txt +++ b/Attic/timer/info.txt diff --git a/src/timer/posix_rt/info.txt b/Attic/timer/posix_rt/info.txt index fa530ea1a..fa530ea1a 100644 --- a/src/timer/posix_rt/info.txt +++ b/Attic/timer/posix_rt/info.txt diff --git a/src/timer/posix_rt/tm_posix.cpp b/Attic/timer/posix_rt/tm_posix.cpp index 96182025c..96182025c 100644 --- a/src/timer/posix_rt/tm_posix.cpp +++ b/Attic/timer/posix_rt/tm_posix.cpp diff --git a/src/timer/posix_rt/tm_posix.h b/Attic/timer/posix_rt/tm_posix.h index 8bedccfa2..8bedccfa2 100644 --- a/src/timer/posix_rt/tm_posix.h +++ b/Attic/timer/posix_rt/tm_posix.h diff --git a/src/timer/timer.cpp b/Attic/timer/timer.cpp index 16d7dc368..16d7dc368 100644 --- a/src/timer/timer.cpp +++ b/Attic/timer/timer.cpp diff --git a/src/timer/timer.h b/Attic/timer/timer.h index 603027f6d..603027f6d 100644 --- a/src/timer/timer.h +++ b/Attic/timer/timer.h diff --git a/src/timer/win32_query_perf_ctr/info.txt b/Attic/timer/win32_query_perf_ctr/info.txt index 4bb1ddb34..4bb1ddb34 100644 --- a/src/timer/win32_query_perf_ctr/info.txt +++ b/Attic/timer/win32_query_perf_ctr/info.txt diff --git a/src/timer/win32_query_perf_ctr/tm_win32.cpp b/Attic/timer/win32_query_perf_ctr/tm_win32.cpp index 6b878e6e2..6b878e6e2 100644 --- a/src/timer/win32_query_perf_ctr/tm_win32.cpp +++ b/Attic/timer/win32_query_perf_ctr/tm_win32.cpp diff --git a/src/timer/win32_query_perf_ctr/tm_win32.h b/Attic/timer/win32_query_perf_ctr/tm_win32.h index 5bcb720ab..5bcb720ab 100644 --- a/src/timer/win32_query_perf_ctr/tm_win32.h +++ b/Attic/timer/win32_query_perf_ctr/tm_win32.h diff --git a/checks/cvc_tests.cpp b/checks/cvc_tests.cpp index 369da4a8c..4b2ffa9a6 100644 --- a/checks/cvc_tests.cpp +++ b/checks/cvc_tests.cpp @@ -27,8 +27,8 @@ #include <botan/look_pk.h> #include <botan/cvc_self.h> #include <botan/cvc_cert.h> -#include <botan/timer.h> #include <botan/cvc_ado.h> +#include <botan/time.h> #define TEST_DATA_DIR "checks/ecc_testdata" diff --git a/src/asn1/asn1_tm.cpp b/src/asn1/asn1_tm.cpp index 09bc4d347..c57d1bc73 100644 --- a/src/asn1/asn1_tm.cpp +++ b/src/asn1/asn1_tm.cpp @@ -10,7 +10,7 @@ #include <botan/ber_dec.h> #include <botan/charset.h> #include <botan/parsing.h> -#include <botan/timer.h> +#include <botan/time.h> namespace Botan { diff --git a/src/cert/cvc/asn1_eac_tm.cpp b/src/cert/cvc/asn1_eac_tm.cpp index 947b9e66d..f361e6098 100644 --- a/src/cert/cvc/asn1_eac_tm.cpp +++ b/src/cert/cvc/asn1_eac_tm.cpp @@ -12,7 +12,7 @@ #include <botan/charset.h> #include <botan/parsing.h> #include <botan/rounding.h> -#include <botan/timer.h> +#include <botan/time.h> namespace Botan { diff --git a/src/cert/cvc/cvc_self.cpp b/src/cert/cvc/cvc_self.cpp index 46bf145fc..98d90d0af 100644 --- a/src/cert/cvc/cvc_self.cpp +++ b/src/cert/cvc/cvc_self.cpp @@ -14,7 +14,7 @@ #include <botan/look_pk.h> #include <botan/cvc_req.h> #include <botan/cvc_ado.h> -#include <botan/timer.h> +#include <botan/time.h> #include <sstream> namespace Botan { diff --git a/src/cert/x509/crl_ent.cpp b/src/cert/x509/crl_ent.cpp index a8a989c24..42a742ebb 100644 --- a/src/cert/x509/crl_ent.cpp +++ b/src/cert/x509/crl_ent.cpp @@ -11,7 +11,7 @@ #include <botan/ber_dec.h> #include <botan/bigint.h> #include <botan/oids.h> -#include <botan/timer.h> +#include <botan/time.h> namespace Botan { diff --git a/src/cert/x509/x509_ca.cpp b/src/cert/x509/x509_ca.cpp index c3ab2a739..4c4748065 100644 --- a/src/cert/x509/x509_ca.cpp +++ b/src/cert/x509/x509_ca.cpp @@ -13,7 +13,7 @@ #include <botan/bigint.h> #include <botan/parsing.h> #include <botan/oids.h> -#include <botan/timer.h> +#include <botan/time.h> #include <algorithm> #include <typeinfo> #include <iterator> diff --git a/src/cert/x509/x509opt.cpp b/src/cert/x509/x509opt.cpp index 03bcd20f4..c6421d9ca 100644 --- a/src/cert/x509/x509opt.cpp +++ b/src/cert/x509/x509opt.cpp @@ -8,7 +8,7 @@ #include <botan/x509self.h> #include <botan/oids.h> #include <botan/parsing.h> -#include <botan/timer.h> +#include <botan/time.h> namespace Botan { diff --git a/src/cert/x509/x509stor.cpp b/src/cert/x509/x509stor.cpp index 9c6dced25..515215a21 100644 --- a/src/cert/x509/x509stor.cpp +++ b/src/cert/x509/x509stor.cpp @@ -10,7 +10,7 @@ #include <botan/pubkey.h> #include <botan/look_pk.h> #include <botan/oids.h> -#include <botan/timer.h> +#include <botan/time.h> #include <algorithm> #include <memory> diff --git a/src/rng/auto_rng/info.txt b/src/rng/auto_rng/info.txt index 7d5d5ddcc..3c83bfb5e 100644 --- a/src/rng/auto_rng/info.txt +++ b/src/rng/auto_rng/info.txt @@ -12,5 +12,4 @@ auto_rng.cpp <requires> hmac sha2 -timer </requires> diff --git a/src/utils/time.h b/src/utils/time.h new file mode 100644 index 000000000..3052aec44 --- /dev/null +++ b/src/utils/time.h @@ -0,0 +1,39 @@ +/* +* Time Functions +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_TIME_OPS_H__ +#define BOTAN_TIME_OPS_H__ + +#include <ctime> + +namespace Botan { + +/* +* Convert a time_t value to a struct tm +*/ +inline std::tm time_t_to_tm(u64bit time_int) + { + std::time_t time_val = static_cast<std::time_t>(time_int); + + 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); + } + +/** +* Get the system clock +*/ +inline u64bit system_time() + { + return static_cast<u64bit>(std::time(0)); + } + +} + + +#endif |