I try to convert the following time string to epoch in milliseconds
"2022-09-25T10:07:41.000Z"
i tried the following code which outputs only epoch time in seconds (1661422061) how to get the epoch time in milliseconds.
#include <iostream>
#include <sstream>
#include <locale>
#include <iomanip>
#include <string>
int main()
{
int tt;
std::tm t = {};
std::string timestamp = "2022-09-25T10:07:41.000Z";
std::istringstream ss(timestamp);
if (ss >> std::get_time(&t, "%Y-%m-%dT%H:%M:%S.000Z"))
{
tt = std::mktime(&t);
std::cout << std::put_time(&t, "%c") << "\n"
<< tt << "\n";
}
else
{
std::cout << "Parse failed\n";
}
return 0;
}