[time.zone.leap] # 30 Time library [[time]](./#time) ## 30.11 Time zones [[time.zone]](time.zone#leap) ### 30.11.8 Class leap_second [time.zone.leap] #### [30.11.8.1](#overview) Overview [[time.zone.leap.overview]](time.zone.leap.overview) namespace std::chrono {class leap_second {public: leap_second(const leap_second&) = default; leap_second& operator=(const leap_second&) = default; // unspecified additional constructorsconstexpr sys_seconds date() const noexcept; constexpr seconds value() const noexcept; };} [1](#overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10136) Objects of type leap_second representing the date and value of the leap second insertions are constructed and stored in the time zone database when initialized[.](#overview-1.sentence-1) [2](#overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10141) [*Example [1](#overview-example-1)*: for (auto& l : get_tzdb().leap_seconds)if (l <= sys_days{2018y/March/17d}) cout << l.date() << ": " << l.value() << '\n'; Produces the output: ``` 1972-07-01 00:00:00: 1s 1973-01-01 00:00:00: 1s 1974-01-01 00:00:00: 1s 1975-01-01 00:00:00: 1s 1976-01-01 00:00:00: 1s 1977-01-01 00:00:00: 1s 1978-01-01 00:00:00: 1s 1979-01-01 00:00:00: 1s 1980-01-01 00:00:00: 1s 1981-07-01 00:00:00: 1s 1982-07-01 00:00:00: 1s 1983-07-01 00:00:00: 1s 1985-07-01 00:00:00: 1s 1988-01-01 00:00:00: 1s 1990-01-01 00:00:00: 1s 1991-01-01 00:00:00: 1s 1992-07-01 00:00:00: 1s 1993-07-01 00:00:00: 1s 1994-07-01 00:00:00: 1s 1996-01-01 00:00:00: 1s 1997-07-01 00:00:00: 1s 1999-01-01 00:00:00: 1s 2006-01-01 00:00:00: 1s 2009-01-01 00:00:00: 1s 2012-07-01 00:00:00: 1s 2015-07-01 00:00:00: 1s 2017-01-01 00:00:00: 1s ``` — *end example*] #### [30.11.8.2](#members) Member functions [[time.zone.leap.members]](time.zone.leap.members) [🔗](#lib:date,leap_second) `constexpr sys_seconds date() const noexcept; ` [1](#members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10189) *Returns*: The date and time at which the leap second was inserted[.](#members-1.sentence-1) [🔗](#lib:value,leap_second) `constexpr seconds value() const noexcept; ` [2](#members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10200) *Returns*: +1s to indicate a positive leap second or-1s to indicate a negative leap second[.](#members-2.sentence-1) [*Note [1](#members-note-1)*: All leap seconds inserted up through 2022 were positive leap seconds[.](#members-2.sentence-2) — *end note*] #### [30.11.8.3](#nonmembers) Non-member functions [[time.zone.leap.nonmembers]](time.zone.leap.nonmembers) [🔗](#lib:operator==,leap_second) `constexpr bool operator==(const leap_second& x, const leap_second& y) noexcept; ` [1](#nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10217) *Returns*: x.date() == y.date()[.](#nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,leap_second) `constexpr strong_ordering operator<=>(const leap_second& x, const leap_second& y) noexcept; ` [2](#nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10228) *Returns*: x.date() <=> y.date()[.](#nonmembers-2.sentence-1) [🔗](#lib:operator==,leap_second_) `template constexpr bool operator==(const leap_second& x, const sys_time& y) noexcept; ` [3](#nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10241) *Returns*: x.date() == y[.](#nonmembers-3.sentence-1) [🔗](#lib:operator%3c,leap_second) `template constexpr bool operator<(const leap_second& x, const sys_time& y) noexcept; ` [4](#nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10254) *Returns*: x.date() < y[.](#nonmembers-4.sentence-1) [🔗](#lib:operator%3c,leap_second_) `template constexpr bool operator<(const sys_time& x, const leap_second& y) noexcept; ` [5](#nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10267) *Returns*: x < y.date()[.](#nonmembers-5.sentence-1) [🔗](#lib:operator%3e,leap_second) `template constexpr bool operator>(const leap_second& x, const sys_time& y) noexcept; ` [6](#nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10280) *Returns*: y < x[.](#nonmembers-6.sentence-1) [🔗](#lib:operator%3e,leap_second_) `template constexpr bool operator>(const sys_time& x, const leap_second& y) noexcept; ` [7](#nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10293) *Returns*: y < x[.](#nonmembers-7.sentence-1) [🔗](#lib:operator%3c=,leap_second) `template constexpr bool operator<=(const leap_second& x, const sys_time& y) noexcept; ` [8](#nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10306) *Returns*: !(y < x)[.](#nonmembers-8.sentence-1) [🔗](#lib:operator%3c=,leap_second_) `template constexpr bool operator<=(const sys_time& x, const leap_second& y) noexcept; ` [9](#nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10319) *Returns*: !(y < x)[.](#nonmembers-9.sentence-1) [🔗](#lib:operator%3e=,leap_second) `template constexpr bool operator>=(const leap_second& x, const sys_time& y) noexcept; ` [10](#nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10332) *Returns*: !(x < y)[.](#nonmembers-10.sentence-1) [🔗](#lib:operator%3e=,leap_second_) `template constexpr bool operator>=(const sys_time& x, const leap_second& y) noexcept; ` [11](#nonmembers-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10345) *Returns*: !(x < y)[.](#nonmembers-11.sentence-1) [🔗](#lib:operator%3c=%3e,leap_second_) `template requires [three_way_comparable_with](cmp.concept#concept:three_way_comparable_with "17.12.4 Concept three_­way_­comparable [cmp.concept]")> constexpr auto operator<=>(const leap_second& x, const sys_time& y) noexcept; ` [12](#nonmembers-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10359) *Returns*: x.date() <=> y[.](#nonmembers-12.sentence-1)