I have written a program that gets SSL certificate expiration date/time using libcurl. But, the problem is that they are being returned in two different format when I run my program on two different operating systems.
Windows: 2031-04-13 23:59:59 GMT
CentOS7: Mar 14 23:59:59 2023 GMT
I don't know if the format would be different again if ran on another OS.
I want to get time since epoch in seconds till that date /time for both of them. Libcurl provides a function to handle the CentOS7 format CURL_GETDATE, and for Windows version I am using boost/date_time . I was wondering if there is something that exist that can do this job i.e. provide date/time in any format!!, and it returns time since epoch in seconds till mentioned date. Or some sort of generic implementation to achieve that?
I found this and this while searching, which is what I am looking for, but this code doesn't work, throwing exception:
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFFB0254FD9 in BoostHttp.exe: Microsoft C++ exception: boost::wrapexcept<boost::gregorian::bad_month> at memory location 0x000000FB1FAFD1F8.
output:
ptime is not-a-date-time
seconds from epoch are 9223372036854
ptime is not-a-date-time
seconds from epoch are 9223372036854
ptime is not-a-date-time
seconds from epoch are 9223372036854
ptime is not-a-date-time
seconds from epoch are 9223372036854
Any help would be appreciated. Thanks