[time.duration.comparisons]

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

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

### 30.5.7 Comparisons [time.duration.comparisons]

[1](#1)

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

In the function descriptions that follow, CT representscommon_type_t<A, B>, where A and B are the types of
the two arguments to the function[.](#1.sentence-1)

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

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

[2](#2)

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

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

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

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

[3](#3)

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

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

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

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

[4](#4)

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

*Returns*: rhs < lhs[.](#4.sentence-1)

[ð](#lib:operator%3c=,duration)

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

[5](#5)

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

*Returns*: !(rhs < lhs)[.](#5.sentence-1)

[ð](#lib:operator%3e=,duration)

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

[6](#6)

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

*Returns*: !(lhs < rhs)[.](#6.sentence-1)

[ð](#lib:operator%3c=%3e,duration)

`template<class Rep1, class Period1, class Rep2, class Period2>
  requires [three_way_comparable](cmp.concept#concept:three_way_comparable "17.12.4 Concept three_­way_­comparable [cmp.concept]")<typename CT::rep>
  constexpr auto operator<=>(const duration<Rep1, Period1>& lhs,
                             const duration<Rep2, Period2>& rhs);
`

[7](#7)

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

*Returns*: CT(lhs).count() <=> CT(rhs).count()[.](#7.sentence-1)
