69 lines
1.7 KiB
Markdown
69 lines
1.7 KiB
Markdown
[time.12]
|
|
|
|
# 30 Time library [[time]](./#time)
|
|
|
|
## 30.10 12/24 hours functions [time.12]
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8663)
|
|
|
|
These functions aid in translating between a 12h format time of day
|
|
and a 24h format time of day[.](#1.sentence-1)
|
|
|
|
[ð](#lib:is_am)
|
|
|
|
`constexpr bool is_am(const hours& h) noexcept;
|
|
`
|
|
|
|
[2](#2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8673)
|
|
|
|
*Returns*: 0h <= h && h <= 11h[.](#2.sentence-1)
|
|
|
|
[ð](#lib:is_pm)
|
|
|
|
`constexpr bool is_pm(const hours& h) noexcept;
|
|
`
|
|
|
|
[3](#3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8684)
|
|
|
|
*Returns*: 12h <= h && h <= 23h[.](#3.sentence-1)
|
|
|
|
[ð](#lib:make12)
|
|
|
|
`constexpr hours make12(const hours& h) noexcept;
|
|
`
|
|
|
|
[4](#4)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8695)
|
|
|
|
*Returns*: The 12-hour equivalent of h in the range [1h, 12h][.](#4.sentence-1)
|
|
|
|
If h is not in the range [0h, 23h],
|
|
the value returned is unspecified[.](#4.sentence-2)
|
|
|
|
[ð](#lib:make24)
|
|
|
|
`constexpr hours make24(const hours& h, bool is_pm) noexcept;
|
|
`
|
|
|
|
[5](#5)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8708)
|
|
|
|
*Returns*: If is_pm is false,
|
|
returns the 24-hour equivalent of h in the range [0h, 11h],
|
|
assuming h represents an ante meridiem hour[.](#5.sentence-1)
|
|
|
|
Otherwise,
|
|
returns the 24-hour equivalent of h in the range [12h, 23h],
|
|
assuming h represents a post meridiem hour[.](#5.sentence-2)
|
|
|
|
If h is not in the range [1h, 12h],
|
|
the value returned is unspecified[.](#5.sentence-3)
|