19 * @brief Returns a timestamp in local time as string formatted like boosts to_iso_string see https://www.boost.org/doc/libs/1_81_0/doc/html/date_time/posix_time.html#ptime_to_string
20 * Example: 19750101T235959.123456
21 * @param time std::chrono::timepoint to convert, defaults to now
35 std::tm tm = *std::localtime(&tt); // local time
36 std::stringstream ss;
37 ss << std::put_time(&tm, "%Y%m%dT%H%M%S");
38
39if (fractional_seconds > 0) {
40 ss << "." << std::setw(6) << std::setfill('0') << fractional_seconds;
41 }
42
43return ss.str();
44}
45
46/**
47 * @brief Parses a iso timestring (see https://www.boost.org/doc/libs/1_81_0/doc/html/date_time/posix_time.html#ptime_to_string) and returns a timepoint
48 * @param timestamp as string formatted like boost iso date
49 * @return std::chrono::time_point with system_clock