You can use the %Q conversion specifier.
std::println("duration: {:%Q} year(s)", duration);
As the comments point out, [31556952]s is the units suffix for std::chrono::years.
You can use the %Q conversion specifier.
std::println("duration: {:%Q} year(s)", duration);
As the comments point out, [31556952]s is the units suffix for std::chrono::years.