I have this function that returns a time_point(system_clock).
using time_point_t = std::chrono::sys_time<std::chrono::microseconds>;
time_point_t decrypt(std::string s) {
time_point_t tp;
std::istringstream in(s);
in >> std::chrono::parse("%Y%m%d-%T", tp);
return tp;
}
When I try to parse this string "20240304-13:00:00:00.002", and display the output, I got 2024-03-04 13:00:00:00.001999
What's wrong, and how to fix this ?
Does std::chrono::ceil(time_point) fix the issue ?
roundshould fix this issue: