aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/asn1')
-rw-r--r--src/asn1/asn1_obj.h3
-rw-r--r--src/asn1/asn1_tm.cpp20
2 files changed, 12 insertions, 11 deletions
diff --git a/src/asn1/asn1_obj.h b/src/asn1/asn1_obj.h
index ea21c475f..a640f712b 100644
--- a/src/asn1/asn1_obj.h
+++ b/src/asn1/asn1_obj.h
@@ -14,6 +14,7 @@
#include <botan/alg_id.h>
#include <vector>
#include <map>
+#include <chrono>
namespace Botan {
@@ -52,7 +53,7 @@ class BOTAN_DLL X509_Time : public ASN1_Object
void set_to(const std::string&);
void set_to(const std::string&, ASN1_Tag);
- X509_Time(u64bit);
+ X509_Time(const std::chrono::system_clock::time_point& time);
X509_Time(const std::string& = "");
X509_Time(const std::string&, ASN1_Tag);
private:
diff --git a/src/asn1/asn1_tm.cpp b/src/asn1/asn1_tm.cpp
index 9df10f4a3..6e56bb8d1 100644
--- a/src/asn1/asn1_tm.cpp
+++ b/src/asn1/asn1_tm.cpp
@@ -23,18 +23,18 @@ X509_Time::X509_Time(const std::string& time_str)
}
/*
-* Create an X509_Time
+* Create a X509_Time from a time point
*/
-X509_Time::X509_Time(u64bit timer)
+X509_Time::X509_Time(const std::chrono::system_clock::time_point& time)
{
- std::tm time_info = time_t_to_tm(timer);
-
- year = time_info.tm_year + 1900;
- month = time_info.tm_mon + 1;
- day = time_info.tm_mday;
- hour = time_info.tm_hour;
- minute = time_info.tm_min;
- second = time_info.tm_sec;
+ calendar_point cal = calendar_value(time);
+
+ year = cal.year;
+ month = cal.month;
+ day = cal.day;
+ hour = cal.hour;
+ minute = cal.minutes;
+ second = cal.seconds;
if(year >= 2050)
tag = GENERALIZED_TIME;