https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116755
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Zartaj Majeed from comment #7) > A duration_cast<seconds>(d2) prevents issue 2 Using +d2.count() in operator<< is a better fix that doesn't require checking whether converting to a different rep is needed (or even possible). > - duration_cast to a bigger > representation type also prevents issue 1 but obviously you're out of luck > with int64_t The right solution is to cast the most negative value to unsigned: duration_cast<duration<make_unsigned_t<rep>, period>>(d1)