parse date and times with {fmt} style intostd::chrono::time_point
{WIP}
#include "get_time.hpp"
// {fmt} for printing
#include <fmt/chrono.h>
#include <fmt/format.h>
int main() {
const auto chrono_time = mgutility::get_time("{:%FT%T.%f%z}", "2023-04-16T00:05:23.999+0100");
fmt::print("{:%F %T}\n", chrono_time); // prints 2023-04-15 23:05:23.999000000 ({fmt} trunk version)
}
- Currently not supported all format specifiers (at least ISO-8601 capable now)
- Requires C++17 and upper
- Performance is ~20x faster than
std::get_time
and ~70x faster thanstd::get_time
+std::mktime
.