aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1/asn1_tm.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-28 22:55:12 +0000
committerlloyd <[email protected]>2009-10-28 22:55:12 +0000
commit3623be3fd05d890309cc3da4b3a1e319e357df65 (patch)
tree34ca43fcf8a7007cc01a3919f63e9ab6763cb673 /src/asn1/asn1_tm.cpp
parentfc1e61500e77fcabe67e6d2607810c1ba071bbdd (diff)
parent9462f875b13a321f42a127166d49670ca04afcde (diff)
propagate from branch 'net.randombit.botan.1_8' (head 3158f8272a3582dd44dfb771665eb71f7d005339)
to branch 'net.randombit.botan' (head bf629b13dd132b263e76a72b7eca0f7e4ab19aac)
Diffstat (limited to 'src/asn1/asn1_tm.cpp')
-rw-r--r--src/asn1/asn1_tm.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/asn1/asn1_tm.cpp b/src/asn1/asn1_tm.cpp
index f85ea128b..09bc4d347 100644
--- a/src/asn1/asn1_tm.cpp
+++ b/src/asn1/asn1_tm.cpp
@@ -10,28 +10,10 @@
#include <botan/ber_dec.h>
#include <botan/charset.h>
#include <botan/parsing.h>
-#include <ctime>
+#include <botan/timer.h>
namespace Botan {
-namespace {
-
-/*
-* Convert a time_t to a struct tm
-*/
-std::tm get_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("X509_Time: gmtime could not encode " +
- to_string(timer));
- return (*tm_p);
- }
-
-}
-
/*
* Create an X509_Time
*/
@@ -45,7 +27,7 @@ X509_Time::X509_Time(const std::string& time_str)
*/
X509_Time::X509_Time(u64bit timer)
{
- std::tm time_info = get_tm(timer);
+ std::tm time_info = time_t_to_tm(timer);
year = time_info.tm_year + 1900;
month = time_info.tm_mon + 1;