aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1/asn1_tm.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-12-01 13:28:16 +0000
committerlloyd <[email protected]>2009-12-01 13:28:16 +0000
commitfe0276ee115bb367810ac2e06833fed297eb1715 (patch)
tree2adf34a771c5dc460f559deb33afd29501fea802 /src/asn1/asn1_tm.cpp
parent4aec044fc21526e1c9185b384f7e984b7f8622c7 (diff)
Remove system_time(), replace entirely with std::chrono.
Only remaining use of time.h/ctime is to convert from a time point to a calendar value, which still requires C's gmtime. Hide it entirely in time.cpp and return a calendar_point struct instead of a std::tm.
Diffstat (limited to 'src/asn1/asn1_tm.cpp')
-rw-r--r--src/asn1/asn1_tm.cpp20
1 files changed, 10 insertions, 10 deletions
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;