https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118811
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> --- Unrelated to the lifetime bug, but why not just use utc_clock here? auto timestamp( std::chrono::duration_cast< std::chrono::nanoseconds >( std::chrono::system_clock::now().time_since_epoch() ) ); std::chrono::zoned_time zt( "UTC", std::chrono::time_point_cast< std::chrono::microseconds >( std::chrono::sys_time< std::chrono::nanoseconds >( timestamp ) ) ); return std::format( "{:%Y-%m-%dT%TZ}", zt ); Why not simply: auto ut = std::chrono::utc_clock::now(); auto mut = std::chrono::time_point_cast<std::chrono::microseconds>(ut); return std::format( "{:%Y-%m-%dT%TZ}", mut ); ?