Files
cppdraft_translate/cppdraft/time/12.md
2025-10-25 03:02:53 +03:00

1.7 KiB

[time.12]

30 Time library [time]

30.10 12/24 hours functions [time.12]

1

#

These functions aid in translating between a 12h format time of day and a 24h format time of day.

🔗

constexpr bool is_am(const hours& h) noexcept;

2

#

Returns: 0h <= h && h <= 11h.

🔗

constexpr bool is_pm(const hours& h) noexcept;

3

#

Returns: 12h <= h && h <= 23h.

🔗

constexpr hours make12(const hours& h) noexcept;

4

#

Returns: The 12-hour equivalent of h in the range [1h, 12h].

If h is not in the range [0h, 23h], the value returned is unspecified.

🔗

constexpr hours make24(const hours& h, bool is_pm) noexcept;

5

#

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.

Otherwise, returns the 24-hour equivalent of h in the range [12h, 23h], assuming h represents a post meridiem hour.

If h is not in the range [1h, 12h], the value returned is unspecified.