Duration& Duration::operator+=(const Duration &rhs) { sec += rhs.sec; nsec += rhs.nsec; normalizeSecNSecSigned(sec, nsec); return *this; }
void normalizeSecNSecSigned(int32_t& sec, int32_t& nsec) { int64_t sec64 = sec; int64_t nsec64 = nsec; normalizeSecNSecSigned(sec64, nsec64); sec = (int32_t) sec64; nsec = (int32_t) nsec64; }
Duration& Duration::operator*=(double scale){ sec *= scale; nsec *= scale; normalizeSecNSecSigned(sec, nsec); return *this; }