[time.hash]

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

## 30.14 Hash support [time.hash]

[ð](#lib:hash,duration)

`template<class Rep, class Period> struct hash<chrono::duration<Rep, Period>>;
`

[1](#1)

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

The specialization hash<chrono​::​duration<Rep, Period>> is enabled ([[unord.hash]](unord.hash "22.10.19 Class template hash"))
if and only if   

hash<Rep> is enabled[.](#1.sentence-2)

The member functions are not guaranteed to be noexcept[.](#1.sentence-3)

[ð](#lib:hash,time_point)

`template<class Clock, class Duration> struct hash<chrono::time_point<Clock, Duration>>;
`

[2](#2)

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

The specialization hash<chrono​::​time_point<Clock, Duration>> is enabled ([[unord.hash]](unord.hash "22.10.19 Class template hash"))
if and only if hash<Duration> is enabled[.](#2.sentence-1)

The member functions are not guaranteed to be noexcept[.](#2.sentence-2)

[ð](#lib:hash,day)

`template<> struct hash<chrono::day>;
template<> struct hash<chrono::month>;
template<> struct hash<chrono::year>;
template<> struct hash<chrono::weekday>;
template<> struct hash<chrono::weekday_indexed>;
template<> struct hash<chrono::weekday_last>;
template<> struct hash<chrono::month_day>;
template<> struct hash<chrono::month_day_last>;
template<> struct hash<chrono::month_weekday>;
template<> struct hash<chrono::month_weekday_last>;
template<> struct hash<chrono::year_month>;
template<> struct hash<chrono::year_month_day>;
template<> struct hash<chrono::year_month_day_last>;
template<> struct hash<chrono::year_month_weekday>;
template<> struct hash<chrono::year_month_weekday_last>;
`

[3](#3)

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

The specializations are enabled ([[unord.hash]](unord.hash "22.10.19 Class template hash"))[.](#3.sentence-1)

[*Note [1](#note-1)*:

All the hash<Key> specializations listed above meet the[*Cpp17Hash*](hash.requirements#:Cpp17Hash "16.4.4.5 Cpp17Hash requirements [hash.requirements]") requirements, even when called on objects k of type Key such that k.ok() is false[.](#3.sentence-2)

â *end note*]

[ð](#lib:hash,zoned_time)

`template<class Duration, class TimeZonePtr>
  struct hash<chrono::zoned_time<Duration, TimeZonePtr>>;
`

[4](#4)

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

The specialization hash<chrono​::​zoned_time<Duration, TimeZonePtr>> is enabled ([[unord.hash]](unord.hash "22.10.19 Class template hash"))
if and only if hash<Duration> is enabled andhash<TimeZonePtr> is enabled[.](#4.sentence-1)

The member functions are not guaranteed to be noexcept[.](#4.sentence-2)

[ð](#lib:hash,leap_second)

`template<> struct hash<chrono::leap_second>;
`

[5](#5)

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

The specialization is enabled ([[unord.hash]](unord.hash "22.10.19 Class template hash"))[.](#5.sentence-1)
