diff --git a/src/ChronoWrapper.cpp b/src/ChronoWrapper.cpp index ce8f18c..8b2b917 100644 --- a/src/ChronoWrapper.cpp +++ b/src/ChronoWrapper.cpp @@ -4,8 +4,8 @@ std::chrono::high_resolution_clock::duration ChronoWrapper::TimeFromStringWithLiteral(const std::string& time_str) { - // const std::regex time_regex(R"((\d+)(min|ms|us|ns|[dhs]))"); //i.e one of: "25ns, 6us, 256ms, 2s, 13min, 69h, 356d" will get matched (only available in newer C++ versions) - const std::regex time_regex(R"((\d+\.*\d*)(min|[dhs]))"); //i.e one of: "2.01s, 13min, 69h, 356.69d" will get matched + // const std::regex time_regex(R"((\d+\.{0,1}\d*)(min|ms|us|ns|[dhs]))"); //i.e one of: "25ns, 6us, 256ms, 2s, 13min, 69h, 356d" will get matched (only available in newer C++ versions) + const std::regex time_regex(R"((\d+\.{0,1}\d*)(min|[dhs]))"); //i.e one of: "2.01s, 13min, 69h, 356.69d" will get matched std::smatch match; float time_value; if (!std::regex_search(time_str, match, time_regex)) return std::chrono::nanoseconds(0);