Skip to main content
2 of 2
added 162 characters in body
Caleth
  • 66.3k
  • 2
  • 53
  • 103

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.

Caleth
  • 66.3k
  • 2
  • 53
  • 103