[time.duration.nonmember]

# 30 Time library [[time]](./#time)

## 30.5 Class template duration [[time.duration]](time.duration#nonmember)

### 30.5.6 Non-member arithmetic [time.duration.nonmember]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1600)

In the function descriptions that follow, unless stated otherwise,
let CD represent the return type of the function[.](#1.sentence-1)

[ð](#lib:operator+,duration)

`template<class Rep1, class Period1, class Rep2, class Period2>
  constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
    operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1612)

*Returns*: CD(CD(lhs).count() + CD(rhs).count())[.](#2.sentence-1)

[ð](#lib:operator-,duration)

`template<class Rep1, class Period1, class Rep2, class Period2>
  constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
    operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1625)

*Returns*: CD(CD(lhs).count() - CD(rhs).count())[.](#3.sentence-1)

[ð](#lib:operator*,duration)

`template<class Rep1, class Period, class Rep2>
  constexpr duration<common_type_t<Rep1, Rep2>, Period>
    operator*(const duration<Rep1, Period>& d, const Rep2& s);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1638)

*Constraints*: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1642)

*Returns*: CD(CD(d).count() * s)[.](#5.sentence-1)

[ð](#lib:operator*,duration_)

`template<class Rep1, class Rep2, class Period>
  constexpr duration<common_type_t<Rep1, Rep2>, Period>
    operator*(const Rep1& s, const duration<Rep2, Period>& d);
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1655)

*Constraints*: is_convertible_v<const Rep1&, common_type_t<Rep1, Rep2>> is true[.](#6.sentence-1)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1659)

*Returns*: d * s[.](#7.sentence-1)

[ð](#lib:operator/,duration)

`template<class Rep1, class Period, class Rep2>
  constexpr duration<common_type_t<Rep1, Rep2>, Period>
    operator/(const duration<Rep1, Period>& d, const Rep2& s);
`

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1672)

*Constraints*: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true and Rep2 is not a specialization of duration[.](#8.sentence-1)

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1677)

*Returns*: CD(CD(d).count() / s)[.](#9.sentence-1)

[ð](#lib:operator/,duration_)

`template<class Rep1, class Period1, class Rep2, class Period2>
  constexpr common_type_t<Rep1, Rep2>
    operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
`

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1690)

Let CD becommon_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>[.](#10.sentence-1)

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1694)

*Returns*: CD(lhs).count() / CD(rhs).count()[.](#11.sentence-1)

[ð](#lib:operator%25,duration)

`template<class Rep1, class Period, class Rep2>
  constexpr duration<common_type_t<Rep1, Rep2>, Period>
    operator%(const duration<Rep1, Period>& d, const Rep2& s);
`

[12](#12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1707)

*Constraints*: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true andRep2 is not a specialization of duration[.](#12.sentence-1)

[13](#13)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1712)

*Returns*: CD(CD(d).count() % s)[.](#13.sentence-1)

[ð](#lib:operator%25,duration_)

`template<class Rep1, class Period1, class Rep2, class Period2>
  constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
    operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
`

[14](#14)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1725)

*Returns*: CD(CD(lhs).count() % CD(rhs).count())[.](#14.sentence-1)
