aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-08-02 08:18:51 -0400
committerJack Lloyd <[email protected]>2016-08-02 08:18:51 -0400
commit9a628acae022e3d790157769d5a2cbe138841f5e (patch)
treec3df5629475c49b95c55a0dba405e53ea566e658 /src/lib/asn1
parented5880991b5fc5be9951ab3dbe472734a990595e (diff)
parent97500d3c7585cad3808ad9f7fa749268ff6fb33a (diff)
Merge GH #560
Diffstat (limited to 'src/lib/asn1')
-rw-r--r--src/lib/asn1/asn1_time.cpp5
-rw-r--r--src/lib/asn1/asn1_time.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/asn1/asn1_time.cpp b/src/lib/asn1/asn1_time.cpp
index 67fc8b5ac..b091c4160 100644
--- a/src/lib/asn1/asn1_time.cpp
+++ b/src/lib/asn1/asn1_time.cpp
@@ -250,6 +250,11 @@ bool X509_Time::passes_sanity_check() const
return true;
}
+std::chrono::system_clock::time_point X509_Time::to_std_timepoint() const
+ {
+ return calendar_point(m_year, m_month, m_day, m_hour, m_minute, m_second).to_std_timepoint();
+ }
+
/*
* Compare two X509_Times for in various ways
*/
diff --git a/src/lib/asn1/asn1_time.h b/src/lib/asn1/asn1_time.h
index ba5b84838..ee30221ee 100644
--- a/src/lib/asn1/asn1_time.h
+++ b/src/lib/asn1/asn1_time.h
@@ -46,6 +46,9 @@ class BOTAN_DLL X509_Time final : public ASN1_Object
/// Create an X509_Time from string
X509_Time(const std::string& t_spec, ASN1_Tag tag);
+ /// Returns a STL timepoint object
+ std::chrono::system_clock::time_point to_std_timepoint() const;
+
private:
void set_to(const std::string& t_spec, ASN1_Tag);
bool passes_sanity_check() const;