Init
This commit is contained in:
68
cppdraft/time/12.md
Normal file
68
cppdraft/time/12.md
Normal file
@@ -0,0 +1,68 @@
|
||||
[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)
|
||||
4355
cppdraft/time/cal.md
Normal file
4355
cppdraft/time/cal.md
Normal file
File diff suppressed because it is too large
Load Diff
295
cppdraft/time/cal/day.md
Normal file
295
cppdraft/time/cal/day.md
Normal file
@@ -0,0 +1,295 @@
|
||||
[time.cal.day]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#day)
|
||||
|
||||
### 30.8.3 Class day [time.cal.day]
|
||||
|
||||
#### [30.8.3.1](#overview) Overview [[time.cal.day.overview]](time.cal.day.overview)
|
||||
|
||||
namespace std::chrono {class day {unsigned char d_; // *exposition only*public: day() = default; constexpr explicit day(unsigned d) noexcept; constexpr day& operator++() noexcept; constexpr day operator++(int) noexcept; constexpr day& operator--() noexcept; constexpr day operator--(int) noexcept; constexpr day& operator+=(const days& d) noexcept; constexpr day& operator-=(const days& d) noexcept; constexpr explicit operator unsigned() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3968)
|
||||
|
||||
day represents a day of a month[.](#overview-1.sentence-1)
|
||||
|
||||
It normally holds values in the range 1 to 31,
|
||||
but may hold non-negative values outside this range[.](#overview-1.sentence-2)
|
||||
|
||||
It can be constructed with any unsigned value,
|
||||
which will be subsequently truncated to fit into day's unspecified internal storage[.](#overview-1.sentence-3)
|
||||
|
||||
day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements,
|
||||
and participates in basic arithmetic with days objects,
|
||||
which represent a difference between two day objects[.](#overview-1.sentence-4)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3979)
|
||||
|
||||
day is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.3.2](#members) Member functions [[time.cal.day.members]](time.cal.day.members)
|
||||
|
||||
[ð](#lib:day,constructor)
|
||||
|
||||
`constexpr explicit day(unsigned d) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3990)
|
||||
|
||||
*Effects*: Initializes d_ with d[.](#members-1.sentence-1)
|
||||
|
||||
The value held is unspecified if d is not in the range [0, 255][.](#members-1.sentence-2)
|
||||
|
||||
[ð](#lib:operator++,day)
|
||||
|
||||
`constexpr day& operator++() noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4002)
|
||||
|
||||
*Effects*: ++d_[.](#members-2.sentence-1)
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4006)
|
||||
|
||||
*Returns*: *this[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,day_)
|
||||
|
||||
`constexpr day operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4017)
|
||||
|
||||
*Effects*: ++(*this)[.](#members-4.sentence-1)
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4021)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,day)
|
||||
|
||||
`constexpr day& operator--() noexcept;
|
||||
`
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4032)
|
||||
|
||||
*Effects*: Equivalent to: --d_[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4036)
|
||||
|
||||
*Returns*: *this[.](#members-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,day_)
|
||||
|
||||
`constexpr day operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4047)
|
||||
|
||||
*Effects*: --(*this)[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4051)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,day)
|
||||
|
||||
`constexpr day& operator+=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4062)
|
||||
|
||||
*Effects*: *this = *this + d[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4066)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,day)
|
||||
|
||||
`constexpr day& operator-=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4077)
|
||||
|
||||
*Effects*: *this = *this - d[.](#members-12.sentence-1)
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4081)
|
||||
|
||||
*Returns*: *this[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator_unsigned,day)
|
||||
|
||||
`constexpr explicit operator unsigned() const noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4092)
|
||||
|
||||
*Returns*: d_[.](#members-14.sentence-1)
|
||||
|
||||
[ð](#lib:ok,day)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4103)
|
||||
|
||||
*Returns*: 1 <= d_ && d_ <= 31[.](#members-15.sentence-1)
|
||||
|
||||
#### [30.8.3.3](#nonmembers) Non-member functions [[time.cal.day.nonmembers]](time.cal.day.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,day)
|
||||
|
||||
`constexpr bool operator==(const day& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4116)
|
||||
|
||||
*Returns*: unsigned{x} == unsigned{y}[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,day)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4127)
|
||||
|
||||
*Returns*: unsigned{x} <=> unsigned{y}[.](#nonmembers-2.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,day)
|
||||
|
||||
`constexpr day operator+(const day& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4138)
|
||||
|
||||
*Returns*: day(unsigned{x} + y.count())[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,day_)
|
||||
|
||||
`constexpr day operator+(const days& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4149)
|
||||
|
||||
*Returns*: y + x[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,day)
|
||||
|
||||
`constexpr day operator-(const day& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4160)
|
||||
|
||||
*Returns*: x + -y[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,day_)
|
||||
|
||||
`constexpr days operator-(const day& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4171)
|
||||
|
||||
*Returns*: days{int(unsigned{x}) - int(unsigned{y})}[.](#nonmembers-6.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,day)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const day& d);
|
||||
`
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4184)
|
||||
|
||||
*Effects*: Equivalent to:return os << (d.ok() ? format(*STATICALLY-WIDEN*<charT>("{:%d}"), d) : format(*STATICALLY-WIDEN*<charT>("{:%d} is not a valid day"), d));
|
||||
|
||||
[ð](#lib:from_stream,day)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4204)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the day d using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-8.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid day,is.setstate(ios_base::failbit) is called andd is not modified[.](#nonmembers-8.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-8.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-8.sentence-4)
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4218)
|
||||
|
||||
*Returns*: is[.](#nonmembers-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22d,day)
|
||||
|
||||
`constexpr chrono::day operator""d(unsigned long long d) noexcept;
|
||||
`
|
||||
|
||||
[10](#nonmembers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4229)
|
||||
|
||||
*Returns*: day{static_cast<unsigned>(d)}[.](#nonmembers-10.sentence-1)
|
||||
146
cppdraft/time/cal/day/members.md
Normal file
146
cppdraft/time/cal/day/members.md
Normal file
@@ -0,0 +1,146 @@
|
||||
[time.cal.day.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#day.members)
|
||||
|
||||
### 30.8.3 Class day [[time.cal.day]](time.cal.day#members)
|
||||
|
||||
#### 30.8.3.2 Member functions [time.cal.day.members]
|
||||
|
||||
[ð](#lib:day,constructor)
|
||||
|
||||
`constexpr explicit day(unsigned d) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3990)
|
||||
|
||||
*Effects*: Initializes d_ with d[.](#1.sentence-1)
|
||||
|
||||
The value held is unspecified if d is not in the range [0, 255][.](#1.sentence-2)
|
||||
|
||||
[ð](#lib:operator++,day)
|
||||
|
||||
`constexpr day& operator++() noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4002)
|
||||
|
||||
*Effects*: ++d_[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4006)
|
||||
|
||||
*Returns*: *this[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,day_)
|
||||
|
||||
`constexpr day operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4017)
|
||||
|
||||
*Effects*: ++(*this)[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4021)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,day)
|
||||
|
||||
`constexpr day& operator--() noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4032)
|
||||
|
||||
*Effects*: Equivalent to: --d_[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4036)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,day_)
|
||||
|
||||
`constexpr day operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4047)
|
||||
|
||||
*Effects*: --(*this)[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4051)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,day)
|
||||
|
||||
`constexpr day& operator+=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4062)
|
||||
|
||||
*Effects*: *this = *this + d[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4066)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,day)
|
||||
|
||||
`constexpr day& operator-=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4077)
|
||||
|
||||
*Effects*: *this = *this - d[.](#12.sentence-1)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4081)
|
||||
|
||||
*Returns*: *this[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:operator_unsigned,day)
|
||||
|
||||
`constexpr explicit operator unsigned() const noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4092)
|
||||
|
||||
*Returns*: d_[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:ok,day)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4103)
|
||||
|
||||
*Returns*: 1 <= d_ && d_ <= 31[.](#15.sentence-1)
|
||||
129
cppdraft/time/cal/day/nonmembers.md
Normal file
129
cppdraft/time/cal/day/nonmembers.md
Normal file
@@ -0,0 +1,129 @@
|
||||
[time.cal.day.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#day.nonmembers)
|
||||
|
||||
### 30.8.3 Class day [[time.cal.day]](time.cal.day#nonmembers)
|
||||
|
||||
#### 30.8.3.3 Non-member functions [time.cal.day.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,day)
|
||||
|
||||
`constexpr bool operator==(const day& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4116)
|
||||
|
||||
*Returns*: unsigned{x} == unsigned{y}[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,day)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4127)
|
||||
|
||||
*Returns*: unsigned{x} <=> unsigned{y}[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,day)
|
||||
|
||||
`constexpr day operator+(const day& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4138)
|
||||
|
||||
*Returns*: day(unsigned{x} + y.count())[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,day_)
|
||||
|
||||
`constexpr day operator+(const days& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4149)
|
||||
|
||||
*Returns*: y + x[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,day)
|
||||
|
||||
`constexpr day operator-(const day& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4160)
|
||||
|
||||
*Returns*: x + -y[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,day_)
|
||||
|
||||
`constexpr days operator-(const day& x, const day& y) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4171)
|
||||
|
||||
*Returns*: days{int(unsigned{x}) - int(unsigned{y})}[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,day)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const day& d);
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4184)
|
||||
|
||||
*Effects*: Equivalent to:return os << (d.ok() ? format(*STATICALLY-WIDEN*<charT>("{:%d}"), d) : format(*STATICALLY-WIDEN*<charT>("{:%d} is not a valid day"), d));
|
||||
|
||||
[ð](#lib:from_stream,day)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4204)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the day d using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#8.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid day,is.setstate(ios_base::failbit) is called andd is not modified[.](#8.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#8.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#8.sentence-4)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4218)
|
||||
|
||||
*Returns*: is[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22d,day)
|
||||
|
||||
`constexpr chrono::day operator""d(unsigned long long d) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4229)
|
||||
|
||||
*Returns*: day{static_cast<unsigned>(d)}[.](#10.sentence-1)
|
||||
34
cppdraft/time/cal/day/overview.md
Normal file
34
cppdraft/time/cal/day/overview.md
Normal file
@@ -0,0 +1,34 @@
|
||||
[time.cal.day.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#day.overview)
|
||||
|
||||
### 30.8.3 Class day [[time.cal.day]](time.cal.day#overview)
|
||||
|
||||
#### 30.8.3.1 Overview [time.cal.day.overview]
|
||||
|
||||
namespace std::chrono {class day {unsigned char d_; // *exposition only*public: day() = default; constexpr explicit day(unsigned d) noexcept; constexpr day& operator++() noexcept; constexpr day operator++(int) noexcept; constexpr day& operator--() noexcept; constexpr day operator--(int) noexcept; constexpr day& operator+=(const days& d) noexcept; constexpr day& operator-=(const days& d) noexcept; constexpr explicit operator unsigned() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3968)
|
||||
|
||||
day represents a day of a month[.](#1.sentence-1)
|
||||
|
||||
It normally holds values in the range 1 to 31,
|
||||
but may hold non-negative values outside this range[.](#1.sentence-2)
|
||||
|
||||
It can be constructed with any unsigned value,
|
||||
which will be subsequently truncated to fit into day's unspecified internal storage[.](#1.sentence-3)
|
||||
|
||||
day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements,
|
||||
and participates in basic arithmetic with days objects,
|
||||
which represent a difference between two day objects[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3979)
|
||||
|
||||
day is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
14
cppdraft/time/cal/general.md
Normal file
14
cppdraft/time/cal/general.md
Normal file
@@ -0,0 +1,14 @@
|
||||
[time.cal.general]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#general)
|
||||
|
||||
### 30.8.1 General [time.cal.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3918)
|
||||
|
||||
The types in [[time.cal]](time.cal "30.8 The civil calendar") describe the civil (Gregorian) calendar
|
||||
and its relationship to sys_days and local_days[.](#1.sentence-1)
|
||||
21
cppdraft/time/cal/last.md
Normal file
21
cppdraft/time/cal/last.md
Normal file
@@ -0,0 +1,21 @@
|
||||
[time.cal.last]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#last)
|
||||
|
||||
### 30.8.2 Class last_spec [time.cal.last]
|
||||
|
||||
namespace std::chrono {struct last_spec {explicit last_spec() = default; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3933)
|
||||
|
||||
The type last_spec is used
|
||||
in conjunction with other calendar types
|
||||
to specify the last in a sequence[.](#1.sentence-1)
|
||||
|
||||
For example, depending on context,
|
||||
it can represent the last day of a month,
|
||||
or the last day of the week of a month[.](#1.sentence-2)
|
||||
145
cppdraft/time/cal/md.md
Normal file
145
cppdraft/time/cal/md.md
Normal file
@@ -0,0 +1,145 @@
|
||||
[time.cal.md]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#md)
|
||||
|
||||
### 30.8.9 Class month_day [time.cal.md]
|
||||
|
||||
#### [30.8.9.1](#overview) Overview [[time.cal.md.overview]](time.cal.md.overview)
|
||||
|
||||
namespace std::chrono {class month_day { chrono::month m_; // *exposition only* chrono::day d_; // *exposition only*public: month_day() = default; constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::day day() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5512)
|
||||
|
||||
month_day represents a specific day of a specific month,
|
||||
but with an unspecified year[.](#overview-1.sentence-1)
|
||||
|
||||
month_day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#overview-1.sentence-2)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5518)
|
||||
|
||||
month_day is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.9.2](#members) Member functions [[time.cal.md.members]](time.cal.md.members)
|
||||
|
||||
[ð](#lib:month_day,constructor)
|
||||
|
||||
`constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5529)
|
||||
|
||||
*Effects*: Initializes m_ with m, and d_ with d[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:month,month_day)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5540)
|
||||
|
||||
*Returns*: m_[.](#members-2.sentence-1)
|
||||
|
||||
[ð](#lib:day,month_day)
|
||||
|
||||
`constexpr chrono::day day() const noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5551)
|
||||
|
||||
*Returns*: d_[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month_day)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5562)
|
||||
|
||||
*Returns*: true ifm_.ok() is true,1d <= d_, andd_ is less than or equal to the number of days in month m_;
|
||||
otherwise returns false[.](#members-4.sentence-1)
|
||||
|
||||
When m_ == February,
|
||||
the number of days is considered to be 29[.](#members-4.sentence-2)
|
||||
|
||||
#### [30.8.9.3](#nonmembers) Non-member functions [[time.cal.md.nonmembers]](time.cal.md.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,month_day)
|
||||
|
||||
`constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5581)
|
||||
|
||||
*Returns*: x.month() == y.month() && x.day() == y.day()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,month_day)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const month_day& x, const month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5592)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.month() <=> y.month(); c != 0) return c;return x.day() <=> y.day();
|
||||
|
||||
[ð](#lib:operator%3c%3c,month_day)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month_day& md);
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5609)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/{}"),
|
||||
md.month(), md.day());
|
||||
|
||||
[ð](#lib:from_stream,month_day)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
month_day& md, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5628)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the month_day md using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-4.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid month_day,is.setstate(ios_base::failbit) is called andmd is not modified[.](#nonmembers-4.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-4.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-4.sentence-4)
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5642)
|
||||
|
||||
*Returns*: is[.](#nonmembers-5.sentence-1)
|
||||
57
cppdraft/time/cal/md/members.md
Normal file
57
cppdraft/time/cal/md/members.md
Normal file
@@ -0,0 +1,57 @@
|
||||
[time.cal.md.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#md.members)
|
||||
|
||||
### 30.8.9 Class month_day [[time.cal.md]](time.cal.md#members)
|
||||
|
||||
#### 30.8.9.2 Member functions [time.cal.md.members]
|
||||
|
||||
[ð](#lib:month_day,constructor)
|
||||
|
||||
`constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5529)
|
||||
|
||||
*Effects*: Initializes m_ with m, and d_ with d[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:month,month_day)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5540)
|
||||
|
||||
*Returns*: m_[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:day,month_day)
|
||||
|
||||
`constexpr chrono::day day() const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5551)
|
||||
|
||||
*Returns*: d_[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month_day)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5562)
|
||||
|
||||
*Returns*: true ifm_.ok() is true,1d <= d_, andd_ is less than or equal to the number of days in month m_;
|
||||
otherwise returns false[.](#4.sentence-1)
|
||||
|
||||
When m_ == February,
|
||||
the number of days is considered to be 29[.](#4.sentence-2)
|
||||
75
cppdraft/time/cal/md/nonmembers.md
Normal file
75
cppdraft/time/cal/md/nonmembers.md
Normal file
@@ -0,0 +1,75 @@
|
||||
[time.cal.md.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#md.nonmembers)
|
||||
|
||||
### 30.8.9 Class month_day [[time.cal.md]](time.cal.md#nonmembers)
|
||||
|
||||
#### 30.8.9.3 Non-member functions [time.cal.md.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,month_day)
|
||||
|
||||
`constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5581)
|
||||
|
||||
*Returns*: x.month() == y.month() && x.day() == y.day()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,month_day)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const month_day& x, const month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5592)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.month() <=> y.month(); c != 0) return c;return x.day() <=> y.day();
|
||||
|
||||
[ð](#lib:operator%3c%3c,month_day)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month_day& md);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5609)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/{}"),
|
||||
md.month(), md.day());
|
||||
|
||||
[ð](#lib:from_stream,month_day)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
month_day& md, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5628)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the month_day md using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#4.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid month_day,is.setstate(ios_base::failbit) is called andmd is not modified[.](#4.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#4.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#4.sentence-4)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5642)
|
||||
|
||||
*Returns*: is[.](#5.sentence-1)
|
||||
27
cppdraft/time/cal/md/overview.md
Normal file
27
cppdraft/time/cal/md/overview.md
Normal file
@@ -0,0 +1,27 @@
|
||||
[time.cal.md.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#md.overview)
|
||||
|
||||
### 30.8.9 Class month_day [[time.cal.md]](time.cal.md#overview)
|
||||
|
||||
#### 30.8.9.1 Overview [time.cal.md.overview]
|
||||
|
||||
namespace std::chrono {class month_day { chrono::month m_; // *exposition only* chrono::day d_; // *exposition only*public: month_day() = default; constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::day day() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5512)
|
||||
|
||||
month_day represents a specific day of a specific month,
|
||||
but with an unspecified year[.](#1.sentence-1)
|
||||
|
||||
month_day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5518)
|
||||
|
||||
month_day is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
103
cppdraft/time/cal/mdlast.md
Normal file
103
cppdraft/time/cal/mdlast.md
Normal file
@@ -0,0 +1,103 @@
|
||||
[time.cal.mdlast]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mdlast)
|
||||
|
||||
### 30.8.10 Class month_day_last [time.cal.mdlast]
|
||||
|
||||
namespace std::chrono {class month_day_last { chrono::month m_; // *exposition only*public:constexpr explicit month_day_last(const chrono::month& m) noexcept; constexpr chrono::month month() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5664)
|
||||
|
||||
month_day_last represents the last day of a month[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5667)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A month_day_last object
|
||||
can be constructed using the expression m/last or last/m,
|
||||
where m is an expression of type month[.](#2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#example-1)*: constexpr auto mdl = February/last; // mdl is the last day of February of an as yet unspecified yearstatic_assert(mdl.month() == February); â *end example*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5680)
|
||||
|
||||
month_day_last is a trivially copyable and standard-layout class type[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:month_day_last,constructor)
|
||||
|
||||
`constexpr explicit month_day_last(const chrono::month& m) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5689)
|
||||
|
||||
*Effects*: Initializes m_ with m[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:month,month_day_last)
|
||||
|
||||
`constexpr month month() const noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5700)
|
||||
|
||||
*Returns*: m_[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month_day_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5711)
|
||||
|
||||
*Returns*: m_.ok()[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:operator==,month_day_last)
|
||||
|
||||
`constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5722)
|
||||
|
||||
*Returns*: x.month() == y.month()[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,month_day_last)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const month_day_last& x, const month_day_last& y) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5733)
|
||||
|
||||
*Returns*: x.month() <=> y.month()[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,month_day_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month_day_last& mdl);
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5746)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/last"), mdl.month());
|
||||
310
cppdraft/time/cal/month.md
Normal file
310
cppdraft/time/cal/month.md
Normal file
@@ -0,0 +1,310 @@
|
||||
[time.cal.month]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#month)
|
||||
|
||||
### 30.8.4 Class month [time.cal.month]
|
||||
|
||||
#### [30.8.4.1](#overview) Overview [[time.cal.month.overview]](time.cal.month.overview)
|
||||
|
||||
namespace std::chrono {class month {unsigned char m_; // *exposition only*public: month() = default; constexpr explicit month(unsigned m) noexcept; constexpr month& operator++() noexcept; constexpr month operator++(int) noexcept; constexpr month& operator--() noexcept; constexpr month operator--(int) noexcept; constexpr month& operator+=(const months& m) noexcept; constexpr month& operator-=(const months& m) noexcept; constexpr explicit operator unsigned() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4261)
|
||||
|
||||
month represents a month of a year[.](#overview-1.sentence-1)
|
||||
|
||||
It normally holds values in the range 1 to 12,
|
||||
but may hold non-negative values outside this range[.](#overview-1.sentence-2)
|
||||
|
||||
It can be constructed with any unsigned value,
|
||||
which will be subsequently truncated to fit into month's unspecified internal storage[.](#overview-1.sentence-3)
|
||||
|
||||
month meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements,
|
||||
and participates in basic arithmetic with months objects,
|
||||
which represent a difference between two month objects[.](#overview-1.sentence-4)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4272)
|
||||
|
||||
month is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.4.2](#members) Member functions [[time.cal.month.members]](time.cal.month.members)
|
||||
|
||||
[ð](#lib:month,constructor)
|
||||
|
||||
`constexpr explicit month(unsigned m) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4283)
|
||||
|
||||
*Effects*: Initializes m_ with m[.](#members-1.sentence-1)
|
||||
|
||||
The value held is unspecified if m is not in the range [0, 255][.](#members-1.sentence-2)
|
||||
|
||||
[ð](#lib:operator++,month)
|
||||
|
||||
`constexpr month& operator++() noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4295)
|
||||
|
||||
*Effects*: *this += months{1}[.](#members-2.sentence-1)
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4299)
|
||||
|
||||
*Returns*: *this[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,month_)
|
||||
|
||||
`constexpr month operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4310)
|
||||
|
||||
*Effects*: ++(*this)[.](#members-4.sentence-1)
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4314)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,month)
|
||||
|
||||
`constexpr month& operator--() noexcept;
|
||||
`
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4325)
|
||||
|
||||
*Effects*: *this -= months{1}[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4329)
|
||||
|
||||
*Returns*: *this[.](#members-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,month_)
|
||||
|
||||
`constexpr month operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4340)
|
||||
|
||||
*Effects*: --(*this)[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4344)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,month)
|
||||
|
||||
`constexpr month& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4355)
|
||||
|
||||
*Effects*: *this = *this + m[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4359)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,month)
|
||||
|
||||
`constexpr month& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4370)
|
||||
|
||||
*Effects*: *this = *this - m[.](#members-12.sentence-1)
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4374)
|
||||
|
||||
*Returns*: *this[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator_unsigned,month)
|
||||
|
||||
`constexpr explicit operator unsigned() const noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4385)
|
||||
|
||||
*Returns*: m_[.](#members-14.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4396)
|
||||
|
||||
*Returns*: 1 <= m_ && m_ <= 12[.](#members-15.sentence-1)
|
||||
|
||||
#### [30.8.4.3](#nonmembers) Non-member functions [[time.cal.month.nonmembers]](time.cal.month.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,month)
|
||||
|
||||
`constexpr bool operator==(const month& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4409)
|
||||
|
||||
*Returns*: unsigned{x} == unsigned{y}[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,month)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const month& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4420)
|
||||
|
||||
*Returns*: unsigned{x} <=> unsigned{y}[.](#nonmembers-2.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,month)
|
||||
|
||||
`constexpr month operator+(const month& x, const months& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4431)
|
||||
|
||||
*Returns*: month{modulo(static_cast<long long>(unsigned{x}) + (y.count() - 1), 12) + 1} where modulo(n, 12) computes the remainder of n divided by 12 using Euclidean division[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[*Note [1](#nonmembers-note-1)*:
|
||||
|
||||
Given a divisor of 12, Euclidean division truncates towards negative infinity and
|
||||
always produces a remainder in the range of [0, 11][.](#nonmembers-3.sentence-2)
|
||||
|
||||
Assuming no overflow in the signed summation,
|
||||
this operation results in a month holding a value in the range [1, 12] even if !x.ok()[.](#nonmembers-3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#nonmembers-example-1)*:
|
||||
|
||||
February + months{11} == January[.](#nonmembers-3.sentence-4)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator+,month_)
|
||||
|
||||
`constexpr month operator+(const months& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4454)
|
||||
|
||||
*Returns*: y + x[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,month)
|
||||
|
||||
`constexpr month operator-(const month& x, const months& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4465)
|
||||
|
||||
*Returns*: x + -y[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,month_)
|
||||
|
||||
`constexpr months operator-(const month& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4476)
|
||||
|
||||
*Returns*: If x.ok() == true and y.ok() == true,
|
||||
returns a value m in the range [months{0}, months{11}]
|
||||
satisfying y + m == x[.](#nonmembers-6.sentence-1)
|
||||
|
||||
Otherwise the value returned is unspecified[.](#nonmembers-6.sentence-2)
|
||||
|
||||
[*Example [2](#nonmembers-example-2)*:
|
||||
|
||||
January - February == months{11}[.](#nonmembers-6.sentence-3)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator%3c%3c,month)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month& m);
|
||||
`
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4497)
|
||||
|
||||
*Effects*: Equivalent to:return os << (m.ok() ? format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%b}"), m) : format(os.getloc(), *STATICALLY-WIDEN*<charT>("{} is not a valid month"), static_cast<unsigned>(m)));
|
||||
|
||||
[ð](#lib:from_stream,month)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
month& m, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4518)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the month m using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-8.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid month,is.setstate(ios_base::failbit) is called andm is not modified[.](#nonmembers-8.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-8.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-8.sentence-4)
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4532)
|
||||
|
||||
*Returns*: is[.](#nonmembers-9.sentence-1)
|
||||
146
cppdraft/time/cal/month/members.md
Normal file
146
cppdraft/time/cal/month/members.md
Normal file
@@ -0,0 +1,146 @@
|
||||
[time.cal.month.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#month.members)
|
||||
|
||||
### 30.8.4 Class month [[time.cal.month]](time.cal.month#members)
|
||||
|
||||
#### 30.8.4.2 Member functions [time.cal.month.members]
|
||||
|
||||
[ð](#lib:month,constructor)
|
||||
|
||||
`constexpr explicit month(unsigned m) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4283)
|
||||
|
||||
*Effects*: Initializes m_ with m[.](#1.sentence-1)
|
||||
|
||||
The value held is unspecified if m is not in the range [0, 255][.](#1.sentence-2)
|
||||
|
||||
[ð](#lib:operator++,month)
|
||||
|
||||
`constexpr month& operator++() noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4295)
|
||||
|
||||
*Effects*: *this += months{1}[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4299)
|
||||
|
||||
*Returns*: *this[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,month_)
|
||||
|
||||
`constexpr month operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4310)
|
||||
|
||||
*Effects*: ++(*this)[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4314)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,month)
|
||||
|
||||
`constexpr month& operator--() noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4325)
|
||||
|
||||
*Effects*: *this -= months{1}[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4329)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,month_)
|
||||
|
||||
`constexpr month operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4340)
|
||||
|
||||
*Effects*: --(*this)[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4344)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,month)
|
||||
|
||||
`constexpr month& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4355)
|
||||
|
||||
*Effects*: *this = *this + m[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4359)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,month)
|
||||
|
||||
`constexpr month& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4370)
|
||||
|
||||
*Effects*: *this = *this - m[.](#12.sentence-1)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4374)
|
||||
|
||||
*Returns*: *this[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:operator_unsigned,month)
|
||||
|
||||
`constexpr explicit operator unsigned() const noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4385)
|
||||
|
||||
*Returns*: m_[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4396)
|
||||
|
||||
*Returns*: 1 <= m_ && m_ <= 12[.](#15.sentence-1)
|
||||
144
cppdraft/time/cal/month/nonmembers.md
Normal file
144
cppdraft/time/cal/month/nonmembers.md
Normal file
@@ -0,0 +1,144 @@
|
||||
[time.cal.month.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#month.nonmembers)
|
||||
|
||||
### 30.8.4 Class month [[time.cal.month]](time.cal.month#nonmembers)
|
||||
|
||||
#### 30.8.4.3 Non-member functions [time.cal.month.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,month)
|
||||
|
||||
`constexpr bool operator==(const month& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4409)
|
||||
|
||||
*Returns*: unsigned{x} == unsigned{y}[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,month)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const month& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4420)
|
||||
|
||||
*Returns*: unsigned{x} <=> unsigned{y}[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,month)
|
||||
|
||||
`constexpr month operator+(const month& x, const months& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4431)
|
||||
|
||||
*Returns*: month{modulo(static_cast<long long>(unsigned{x}) + (y.count() - 1), 12) + 1} where modulo(n, 12) computes the remainder of n divided by 12 using Euclidean division[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Given a divisor of 12, Euclidean division truncates towards negative infinity and
|
||||
always produces a remainder in the range of [0, 11][.](#3.sentence-2)
|
||||
|
||||
Assuming no overflow in the signed summation,
|
||||
this operation results in a month holding a value in the range [1, 12] even if !x.ok()[.](#3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
February + months{11} == January[.](#3.sentence-4)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator+,month_)
|
||||
|
||||
`constexpr month operator+(const months& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4454)
|
||||
|
||||
*Returns*: y + x[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,month)
|
||||
|
||||
`constexpr month operator-(const month& x, const months& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4465)
|
||||
|
||||
*Returns*: x + -y[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,month_)
|
||||
|
||||
`constexpr months operator-(const month& x, const month& y) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4476)
|
||||
|
||||
*Returns*: If x.ok() == true and y.ok() == true,
|
||||
returns a value m in the range [months{0}, months{11}]
|
||||
satisfying y + m == x[.](#6.sentence-1)
|
||||
|
||||
Otherwise the value returned is unspecified[.](#6.sentence-2)
|
||||
|
||||
[*Example [2](#example-2)*:
|
||||
|
||||
January - February == months{11}[.](#6.sentence-3)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator%3c%3c,month)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month& m);
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4497)
|
||||
|
||||
*Effects*: Equivalent to:return os << (m.ok() ? format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%b}"), m) : format(os.getloc(), *STATICALLY-WIDEN*<charT>("{} is not a valid month"), static_cast<unsigned>(m)));
|
||||
|
||||
[ð](#lib:from_stream,month)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
month& m, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4518)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the month m using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#8.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid month,is.setstate(ios_base::failbit) is called andm is not modified[.](#8.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#8.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#8.sentence-4)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4532)
|
||||
|
||||
*Returns*: is[.](#9.sentence-1)
|
||||
34
cppdraft/time/cal/month/overview.md
Normal file
34
cppdraft/time/cal/month/overview.md
Normal file
@@ -0,0 +1,34 @@
|
||||
[time.cal.month.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#month.overview)
|
||||
|
||||
### 30.8.4 Class month [[time.cal.month]](time.cal.month#overview)
|
||||
|
||||
#### 30.8.4.1 Overview [time.cal.month.overview]
|
||||
|
||||
namespace std::chrono {class month {unsigned char m_; // *exposition only*public: month() = default; constexpr explicit month(unsigned m) noexcept; constexpr month& operator++() noexcept; constexpr month operator++(int) noexcept; constexpr month& operator--() noexcept; constexpr month operator--(int) noexcept; constexpr month& operator+=(const months& m) noexcept; constexpr month& operator-=(const months& m) noexcept; constexpr explicit operator unsigned() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4261)
|
||||
|
||||
month represents a month of a year[.](#1.sentence-1)
|
||||
|
||||
It normally holds values in the range 1 to 12,
|
||||
but may hold non-negative values outside this range[.](#1.sentence-2)
|
||||
|
||||
It can be constructed with any unsigned value,
|
||||
which will be subsequently truncated to fit into month's unspecified internal storage[.](#1.sentence-3)
|
||||
|
||||
month meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements,
|
||||
and participates in basic arithmetic with months objects,
|
||||
which represent a difference between two month objects[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4272)
|
||||
|
||||
month is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
105
cppdraft/time/cal/mwd.md
Normal file
105
cppdraft/time/cal/mwd.md
Normal file
@@ -0,0 +1,105 @@
|
||||
[time.cal.mwd]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwd)
|
||||
|
||||
### 30.8.11 Class month_weekday [time.cal.mwd]
|
||||
|
||||
#### [30.8.11.1](#overview) Overview [[time.cal.mwd.overview]](time.cal.mwd.overview)
|
||||
|
||||
namespace std::chrono {class month_weekday { chrono::month m_; // *exposition only* chrono::weekday_indexed wdi_; // *exposition only*public:constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_indexed weekday_indexed() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5774)
|
||||
|
||||
month_weekday represents the nth weekday of a month,
|
||||
of an as yet unspecified year[.](#overview-1.sentence-1)
|
||||
|
||||
To do this the month_weekday stores a month and a weekday_indexed[.](#overview-1.sentence-2)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5779)
|
||||
|
||||
[*Example [1](#overview-example-1)*: constexpr auto mwd = February/Tuesday[3]; // mwd is the third Tuesday of February of an as yet unspecified yearstatic_assert(mwd.month() == February);static_assert(mwd.weekday_indexed() == Tuesday[3]); â *end example*]
|
||||
|
||||
[3](#overview-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5789)
|
||||
|
||||
month_weekday is a trivially copyable and standard-layout class type[.](#overview-3.sentence-1)
|
||||
|
||||
#### [30.8.11.2](#members) Member functions [[time.cal.mwd.members]](time.cal.mwd.members)
|
||||
|
||||
[ð](#lib:month_weekday,constructor)
|
||||
|
||||
`constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5800)
|
||||
|
||||
*Effects*: Initializes m_ with m, and wdi_ with wdi[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:month,month_weekday)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5811)
|
||||
|
||||
*Returns*: m_[.](#members-2.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_indexed,month_weekday)
|
||||
|
||||
`constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5822)
|
||||
|
||||
*Returns*: wdi_[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month_weekday)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5833)
|
||||
|
||||
*Returns*: m_.ok() && wdi_.ok()[.](#members-4.sentence-1)
|
||||
|
||||
#### [30.8.11.3](#nonmembers) Non-member functions [[time.cal.mwd.nonmembers]](time.cal.mwd.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,month_weekday)
|
||||
|
||||
`constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5846)
|
||||
|
||||
*Returns*: x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,month_weekday)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd);
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5859)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/{:L}"),
|
||||
mwd.month(), mwd.weekday_indexed());
|
||||
53
cppdraft/time/cal/mwd/members.md
Normal file
53
cppdraft/time/cal/mwd/members.md
Normal file
@@ -0,0 +1,53 @@
|
||||
[time.cal.mwd.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwd.members)
|
||||
|
||||
### 30.8.11 Class month_weekday [[time.cal.mwd]](time.cal.mwd#members)
|
||||
|
||||
#### 30.8.11.2 Member functions [time.cal.mwd.members]
|
||||
|
||||
[ð](#lib:month_weekday,constructor)
|
||||
|
||||
`constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5800)
|
||||
|
||||
*Effects*: Initializes m_ with m, and wdi_ with wdi[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:month,month_weekday)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5811)
|
||||
|
||||
*Returns*: m_[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_indexed,month_weekday)
|
||||
|
||||
`constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5822)
|
||||
|
||||
*Returns*: wdi_[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month_weekday)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5833)
|
||||
|
||||
*Returns*: m_.ok() && wdi_.ok()[.](#4.sentence-1)
|
||||
34
cppdraft/time/cal/mwd/nonmembers.md
Normal file
34
cppdraft/time/cal/mwd/nonmembers.md
Normal file
@@ -0,0 +1,34 @@
|
||||
[time.cal.mwd.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwd.nonmembers)
|
||||
|
||||
### 30.8.11 Class month_weekday [[time.cal.mwd]](time.cal.mwd#nonmembers)
|
||||
|
||||
#### 30.8.11.3 Non-member functions [time.cal.mwd.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,month_weekday)
|
||||
|
||||
`constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5846)
|
||||
|
||||
*Returns*: x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,month_weekday)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5859)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/{:L}"),
|
||||
mwd.month(), mwd.weekday_indexed());
|
||||
32
cppdraft/time/cal/mwd/overview.md
Normal file
32
cppdraft/time/cal/mwd/overview.md
Normal file
@@ -0,0 +1,32 @@
|
||||
[time.cal.mwd.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwd.overview)
|
||||
|
||||
### 30.8.11 Class month_weekday [[time.cal.mwd]](time.cal.mwd#overview)
|
||||
|
||||
#### 30.8.11.1 Overview [time.cal.mwd.overview]
|
||||
|
||||
namespace std::chrono {class month_weekday { chrono::month m_; // *exposition only* chrono::weekday_indexed wdi_; // *exposition only*public:constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_indexed weekday_indexed() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5774)
|
||||
|
||||
month_weekday represents the nth weekday of a month,
|
||||
of an as yet unspecified year[.](#1.sentence-1)
|
||||
|
||||
To do this the month_weekday stores a month and a weekday_indexed[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5779)
|
||||
|
||||
[*Example [1](#example-1)*: constexpr auto mwd = February/Tuesday[3]; // mwd is the third Tuesday of February of an as yet unspecified yearstatic_assert(mwd.month() == February);static_assert(mwd.weekday_indexed() == Tuesday[3]); â *end example*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5789)
|
||||
|
||||
month_weekday is a trivially copyable and standard-layout class type[.](#3.sentence-1)
|
||||
106
cppdraft/time/cal/mwdlast.md
Normal file
106
cppdraft/time/cal/mwdlast.md
Normal file
@@ -0,0 +1,106 @@
|
||||
[time.cal.mwdlast]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwdlast)
|
||||
|
||||
### 30.8.12 Class month_weekday_last [time.cal.mwdlast]
|
||||
|
||||
#### [30.8.12.1](#overview) Overview [[time.cal.mwdlast.overview]](time.cal.mwdlast.overview)
|
||||
|
||||
namespace std::chrono {class month_weekday_last { chrono::month m_; // *exposition only* chrono::weekday_last wdl_; // *exposition only*public:constexpr month_weekday_last(const chrono::month& m, const chrono::weekday_last& wdl) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_last weekday_last() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5889)
|
||||
|
||||
month_weekday_last represents the last weekday of a month,
|
||||
of an as yet unspecified year[.](#overview-1.sentence-1)
|
||||
|
||||
To do this the month_weekday_last stores a month and a weekday_last[.](#overview-1.sentence-2)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5894)
|
||||
|
||||
[*Example [1](#overview-example-1)*: constexpr auto mwd = February/Tuesday[last]; // mwd is the last Tuesday of February of an as yet unspecified yearstatic_assert(mwd.month() == February);static_assert(mwd.weekday_last() == Tuesday[last]); â *end example*]
|
||||
|
||||
[3](#overview-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5904)
|
||||
|
||||
month_weekday_last is a trivially copyable and standard-layout class type[.](#overview-3.sentence-1)
|
||||
|
||||
#### [30.8.12.2](#members) Member functions [[time.cal.mwdlast.members]](time.cal.mwdlast.members)
|
||||
|
||||
[ð](#lib:month_weekday_last,constructor)
|
||||
|
||||
`constexpr month_weekday_last(const chrono::month& m,
|
||||
const chrono::weekday_last& wdl) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5916)
|
||||
|
||||
*Effects*: Initializes m_ with m, and wdl_ with wdl[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:month,month_weekday_last)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5927)
|
||||
|
||||
*Returns*: m_[.](#members-2.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_last,month_weekday_last)
|
||||
|
||||
`constexpr chrono::weekday_last weekday_last() const noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5938)
|
||||
|
||||
*Returns*: wdl_[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month_weekday_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5949)
|
||||
|
||||
*Returns*: m_.ok() && wdl_.ok()[.](#members-4.sentence-1)
|
||||
|
||||
#### [30.8.12.3](#nonmembers) Non-member functions [[time.cal.mwdlast.nonmembers]](time.cal.mwdlast.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,month_weekday_last)
|
||||
|
||||
`constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5962)
|
||||
|
||||
*Returns*: x.month() == y.month() && x.weekday_last() == y.weekday_last()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,month_weekday_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mwdl);
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5975)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/{:L}"),
|
||||
mwdl.month(), mwdl.weekday_last());
|
||||
54
cppdraft/time/cal/mwdlast/members.md
Normal file
54
cppdraft/time/cal/mwdlast/members.md
Normal file
@@ -0,0 +1,54 @@
|
||||
[time.cal.mwdlast.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwdlast.members)
|
||||
|
||||
### 30.8.12 Class month_weekday_last [[time.cal.mwdlast]](time.cal.mwdlast#members)
|
||||
|
||||
#### 30.8.12.2 Member functions [time.cal.mwdlast.members]
|
||||
|
||||
[ð](#lib:month_weekday_last,constructor)
|
||||
|
||||
`constexpr month_weekday_last(const chrono::month& m,
|
||||
const chrono::weekday_last& wdl) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5916)
|
||||
|
||||
*Effects*: Initializes m_ with m, and wdl_ with wdl[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:month,month_weekday_last)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5927)
|
||||
|
||||
*Returns*: m_[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_last,month_weekday_last)
|
||||
|
||||
`constexpr chrono::weekday_last weekday_last() const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5938)
|
||||
|
||||
*Returns*: wdl_[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,month_weekday_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5949)
|
||||
|
||||
*Returns*: m_.ok() && wdl_.ok()[.](#4.sentence-1)
|
||||
34
cppdraft/time/cal/mwdlast/nonmembers.md
Normal file
34
cppdraft/time/cal/mwdlast/nonmembers.md
Normal file
@@ -0,0 +1,34 @@
|
||||
[time.cal.mwdlast.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwdlast.nonmembers)
|
||||
|
||||
### 30.8.12 Class month_weekday_last [[time.cal.mwdlast]](time.cal.mwdlast#nonmembers)
|
||||
|
||||
#### 30.8.12.3 Non-member functions [time.cal.mwdlast.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,month_weekday_last)
|
||||
|
||||
`constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5962)
|
||||
|
||||
*Returns*: x.month() == y.month() && x.weekday_last() == y.weekday_last()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,month_weekday_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mwdl);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5975)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/{:L}"),
|
||||
mwdl.month(), mwdl.weekday_last());
|
||||
32
cppdraft/time/cal/mwdlast/overview.md
Normal file
32
cppdraft/time/cal/mwdlast/overview.md
Normal file
@@ -0,0 +1,32 @@
|
||||
[time.cal.mwdlast.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#mwdlast.overview)
|
||||
|
||||
### 30.8.12 Class month_weekday_last [[time.cal.mwdlast]](time.cal.mwdlast#overview)
|
||||
|
||||
#### 30.8.12.1 Overview [time.cal.mwdlast.overview]
|
||||
|
||||
namespace std::chrono {class month_weekday_last { chrono::month m_; // *exposition only* chrono::weekday_last wdl_; // *exposition only*public:constexpr month_weekday_last(const chrono::month& m, const chrono::weekday_last& wdl) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_last weekday_last() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5889)
|
||||
|
||||
month_weekday_last represents the last weekday of a month,
|
||||
of an as yet unspecified year[.](#1.sentence-1)
|
||||
|
||||
To do this the month_weekday_last stores a month and a weekday_last[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5894)
|
||||
|
||||
[*Example [1](#example-1)*: constexpr auto mwd = February/Tuesday[last]; // mwd is the last Tuesday of February of an as yet unspecified yearstatic_assert(mwd.month() == February);static_assert(mwd.weekday_last() == Tuesday[last]); â *end example*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5904)
|
||||
|
||||
month_weekday_last is a trivially copyable and standard-layout class type[.](#3.sentence-1)
|
||||
527
cppdraft/time/cal/operators.md
Normal file
527
cppdraft/time/cal/operators.md
Normal file
@@ -0,0 +1,527 @@
|
||||
[time.cal.operators]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#operators)
|
||||
|
||||
### 30.8.18 Conventional syntax operators [time.cal.operators]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7904)
|
||||
|
||||
A set of overloaded operator/ functions provides
|
||||
a conventional syntax for the creation of civil calendar dates[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7908)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The year, month, and day are accepted in any of the following 3 orders:*year*/*month*/*day**month*/*day*/*year**day*/*month*/*year*
|
||||
|
||||
Anywhere a *day* is needed, any of the following can also be specified:last*weekday*[*i*]*weekday*[last]
|
||||
|
||||
â *end note*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7925)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Partial-date types such as year_month and month_day can be created by not applying the second division operator
|
||||
for any of the three orders[.](#3.sentence-1)
|
||||
|
||||
For example:year_month ym = 2015y/April;
|
||||
month_day md1 = April/4;
|
||||
month_day md2 = 4d/April;
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7937)
|
||||
|
||||
[*Example [1](#example-1)*: auto a = 2015/4/4; // a == int(125)auto b = 2015y/4/4; // b == year_month_day{year(2015), month(4), day(4)}auto c = 2015y/4d/April; // error: no viable operator/ for first /auto d = 2015/April/4; // error: no viable operator/ for first / â *end example*]
|
||||
|
||||
[ð](#itemdecl:1)
|
||||
|
||||
`constexpr year_month
|
||||
operator/(const year& y, const month& m) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7953)
|
||||
|
||||
*Returns*: {y, m}[.](#5.sentence-1)
|
||||
|
||||
[ð](#itemdecl:2)
|
||||
|
||||
`constexpr year_month
|
||||
operator/(const year& y, int m) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7964)
|
||||
|
||||
*Returns*: y / month(m)[.](#6.sentence-1)
|
||||
|
||||
[ð](#itemdecl:3)
|
||||
|
||||
`constexpr month_day
|
||||
operator/(const month& m, const day& d) noexcept;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7975)
|
||||
|
||||
*Returns*: {m, d}[.](#7.sentence-1)
|
||||
|
||||
[ð](#itemdecl:4)
|
||||
|
||||
`constexpr month_day
|
||||
operator/(const month& m, int d) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7986)
|
||||
|
||||
*Returns*: m / day(d)[.](#8.sentence-1)
|
||||
|
||||
[ð](#itemdecl:5)
|
||||
|
||||
`constexpr month_day
|
||||
operator/(int m, const day& d) noexcept;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7997)
|
||||
|
||||
*Returns*: month(m) / d[.](#9.sentence-1)
|
||||
|
||||
[ð](#itemdecl:6)
|
||||
|
||||
`constexpr month_day
|
||||
operator/(const day& d, const month& m) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8008)
|
||||
|
||||
*Returns*: m / d[.](#10.sentence-1)
|
||||
|
||||
[ð](#itemdecl:7)
|
||||
|
||||
`constexpr month_day
|
||||
operator/(const day& d, int m) noexcept;
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8019)
|
||||
|
||||
*Returns*: month(m) / d[.](#11.sentence-1)
|
||||
|
||||
[ð](#itemdecl:8)
|
||||
|
||||
`constexpr month_day_last
|
||||
operator/(const month& m, last_spec) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8030)
|
||||
|
||||
*Returns*: month_day_last{m}[.](#12.sentence-1)
|
||||
|
||||
[ð](#itemdecl:9)
|
||||
|
||||
`constexpr month_day_last
|
||||
operator/(int m, last_spec) noexcept;
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8041)
|
||||
|
||||
*Returns*: month(m) / last[.](#13.sentence-1)
|
||||
|
||||
[ð](#itemdecl:10)
|
||||
|
||||
`constexpr month_day_last
|
||||
operator/(last_spec, const month& m) noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8052)
|
||||
|
||||
*Returns*: m / last[.](#14.sentence-1)
|
||||
|
||||
[ð](#itemdecl:11)
|
||||
|
||||
`constexpr month_day_last
|
||||
operator/(last_spec, int m) noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8063)
|
||||
|
||||
*Returns*: month(m) / last[.](#15.sentence-1)
|
||||
|
||||
[ð](#itemdecl:12)
|
||||
|
||||
`constexpr month_weekday
|
||||
operator/(const month& m, const weekday_indexed& wdi) noexcept;
|
||||
`
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8074)
|
||||
|
||||
*Returns*: {m, wdi}[.](#16.sentence-1)
|
||||
|
||||
[ð](#itemdecl:13)
|
||||
|
||||
`constexpr month_weekday
|
||||
operator/(int m, const weekday_indexed& wdi) noexcept;
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8085)
|
||||
|
||||
*Returns*: month(m) / wdi[.](#17.sentence-1)
|
||||
|
||||
[ð](#itemdecl:14)
|
||||
|
||||
`constexpr month_weekday
|
||||
operator/(const weekday_indexed& wdi, const month& m) noexcept;
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8096)
|
||||
|
||||
*Returns*: m / wdi[.](#18.sentence-1)
|
||||
|
||||
[ð](#itemdecl:15)
|
||||
|
||||
`constexpr month_weekday
|
||||
operator/(const weekday_indexed& wdi, int m) noexcept;
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8107)
|
||||
|
||||
*Returns*: month(m) / wdi[.](#19.sentence-1)
|
||||
|
||||
[ð](#itemdecl:16)
|
||||
|
||||
`constexpr month_weekday_last
|
||||
operator/(const month& m, const weekday_last& wdl) noexcept;
|
||||
`
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8118)
|
||||
|
||||
*Returns*: {m, wdl}[.](#20.sentence-1)
|
||||
|
||||
[ð](#itemdecl:17)
|
||||
|
||||
`constexpr month_weekday_last
|
||||
operator/(int m, const weekday_last& wdl) noexcept;
|
||||
`
|
||||
|
||||
[21](#21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8129)
|
||||
|
||||
*Returns*: month(m) / wdl[.](#21.sentence-1)
|
||||
|
||||
[ð](#itemdecl:18)
|
||||
|
||||
`constexpr month_weekday_last
|
||||
operator/(const weekday_last& wdl, const month& m) noexcept;
|
||||
`
|
||||
|
||||
[22](#22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8140)
|
||||
|
||||
*Returns*: m / wdl[.](#22.sentence-1)
|
||||
|
||||
[ð](#itemdecl:19)
|
||||
|
||||
`constexpr month_weekday_last
|
||||
operator/(const weekday_last& wdl, int m) noexcept;
|
||||
`
|
||||
|
||||
[23](#23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8151)
|
||||
|
||||
*Returns*: month(m) / wdl[.](#23.sentence-1)
|
||||
|
||||
[ð](#itemdecl:20)
|
||||
|
||||
`constexpr year_month_day
|
||||
operator/(const year_month& ym, const day& d) noexcept;
|
||||
`
|
||||
|
||||
[24](#24)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8162)
|
||||
|
||||
*Returns*: {ym.year(), ym.month(), d}[.](#24.sentence-1)
|
||||
|
||||
[ð](#itemdecl:21)
|
||||
|
||||
`constexpr year_month_day
|
||||
operator/(const year_month& ym, int d) noexcept;
|
||||
`
|
||||
|
||||
[25](#25)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8173)
|
||||
|
||||
*Returns*: ym / day(d)[.](#25.sentence-1)
|
||||
|
||||
[ð](#itemdecl:22)
|
||||
|
||||
`constexpr year_month_day
|
||||
operator/(const year& y, const month_day& md) noexcept;
|
||||
`
|
||||
|
||||
[26](#26)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8184)
|
||||
|
||||
*Returns*: y / md.month() / md.day()[.](#26.sentence-1)
|
||||
|
||||
[ð](#itemdecl:23)
|
||||
|
||||
`constexpr year_month_day
|
||||
operator/(int y, const month_day& md) noexcept;
|
||||
`
|
||||
|
||||
[27](#27)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8195)
|
||||
|
||||
*Returns*: year(y) / md[.](#27.sentence-1)
|
||||
|
||||
[ð](#itemdecl:24)
|
||||
|
||||
`constexpr year_month_day
|
||||
operator/(const month_day& md, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[28](#28)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8206)
|
||||
|
||||
*Returns*: y / md[.](#28.sentence-1)
|
||||
|
||||
[ð](#itemdecl:25)
|
||||
|
||||
`constexpr year_month_day
|
||||
operator/(const month_day& md, int y) noexcept;
|
||||
`
|
||||
|
||||
[29](#29)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8217)
|
||||
|
||||
*Returns*: year(y) / md[.](#29.sentence-1)
|
||||
|
||||
[ð](#itemdecl:26)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator/(const year_month& ym, last_spec) noexcept;
|
||||
`
|
||||
|
||||
[30](#30)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8228)
|
||||
|
||||
*Returns*: {ym.year(), month_day_last{ym.month()}}[.](#30.sentence-1)
|
||||
|
||||
[ð](#itemdecl:27)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator/(const year& y, const month_day_last& mdl) noexcept;
|
||||
`
|
||||
|
||||
[31](#31)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8239)
|
||||
|
||||
*Returns*: {y, mdl}[.](#31.sentence-1)
|
||||
|
||||
[ð](#itemdecl:28)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator/(int y, const month_day_last& mdl) noexcept;
|
||||
`
|
||||
|
||||
[32](#32)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8250)
|
||||
|
||||
*Returns*: year(y) / mdl[.](#32.sentence-1)
|
||||
|
||||
[ð](#itemdecl:29)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator/(const month_day_last& mdl, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[33](#33)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8261)
|
||||
|
||||
*Returns*: y / mdl[.](#33.sentence-1)
|
||||
|
||||
[ð](#itemdecl:30)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator/(const month_day_last& mdl, int y) noexcept;
|
||||
`
|
||||
|
||||
[34](#34)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8272)
|
||||
|
||||
*Returns*: year(y) / mdl[.](#34.sentence-1)
|
||||
|
||||
[ð](#itemdecl:31)
|
||||
|
||||
`constexpr year_month_weekday
|
||||
operator/(const year_month& ym, const weekday_indexed& wdi) noexcept;
|
||||
`
|
||||
|
||||
[35](#35)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8283)
|
||||
|
||||
*Returns*: {ym.year(), ym.month(), wdi}[.](#35.sentence-1)
|
||||
|
||||
[ð](#itemdecl:32)
|
||||
|
||||
`constexpr year_month_weekday
|
||||
operator/(const year& y, const month_weekday& mwd) noexcept;
|
||||
`
|
||||
|
||||
[36](#36)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8294)
|
||||
|
||||
*Returns*: {y, mwd.month(), mwd.weekday_indexed()}[.](#36.sentence-1)
|
||||
|
||||
[ð](#itemdecl:33)
|
||||
|
||||
`constexpr year_month_weekday
|
||||
operator/(int y, const month_weekday& mwd) noexcept;
|
||||
`
|
||||
|
||||
[37](#37)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8305)
|
||||
|
||||
*Returns*: year(y) / mwd[.](#37.sentence-1)
|
||||
|
||||
[ð](#itemdecl:34)
|
||||
|
||||
`constexpr year_month_weekday
|
||||
operator/(const month_weekday& mwd, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[38](#38)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8316)
|
||||
|
||||
*Returns*: y / mwd[.](#38.sentence-1)
|
||||
|
||||
[ð](#itemdecl:35)
|
||||
|
||||
`constexpr year_month_weekday
|
||||
operator/(const month_weekday& mwd, int y) noexcept;
|
||||
`
|
||||
|
||||
[39](#39)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8327)
|
||||
|
||||
*Returns*: year(y) / mwd[.](#39.sentence-1)
|
||||
|
||||
[ð](#itemdecl:36)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator/(const year_month& ym, const weekday_last& wdl) noexcept;
|
||||
`
|
||||
|
||||
[40](#40)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8338)
|
||||
|
||||
*Returns*: {ym.year(), ym.month(), wdl}[.](#40.sentence-1)
|
||||
|
||||
[ð](#itemdecl:37)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator/(const year& y, const month_weekday_last& mwdl) noexcept;
|
||||
`
|
||||
|
||||
[41](#41)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8349)
|
||||
|
||||
*Returns*: {y, mwdl.month(), mwdl.weekday_last()}[.](#41.sentence-1)
|
||||
|
||||
[ð](#itemdecl:38)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator/(int y, const month_weekday_last& mwdl) noexcept;
|
||||
`
|
||||
|
||||
[42](#42)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8360)
|
||||
|
||||
*Returns*: year(y) / mwdl[.](#42.sentence-1)
|
||||
|
||||
[ð](#itemdecl:39)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator/(const month_weekday_last& mwdl, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[43](#43)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8371)
|
||||
|
||||
*Returns*: y / mwdl[.](#43.sentence-1)
|
||||
|
||||
[ð](#itemdecl:40)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator/(const month_weekday_last& mwdl, int y) noexcept;
|
||||
`
|
||||
|
||||
[44](#44)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8382)
|
||||
|
||||
*Returns*: year(y) / mwdl[.](#44.sentence-1)
|
||||
381
cppdraft/time/cal/wd.md
Normal file
381
cppdraft/time/cal/wd.md
Normal file
@@ -0,0 +1,381 @@
|
||||
[time.cal.wd]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wd)
|
||||
|
||||
### 30.8.6 Class weekday [time.cal.wd]
|
||||
|
||||
#### [30.8.6.1](#overview) Overview [[time.cal.wd.overview]](time.cal.wd.overview)
|
||||
|
||||
namespace std::chrono {class weekday {unsigned char wd_; // *exposition only*public: weekday() = default; constexpr explicit weekday(unsigned wd) noexcept; constexpr weekday(const sys_days& dp) noexcept; constexpr explicit weekday(const local_days& dp) noexcept; constexpr weekday& operator++() noexcept; constexpr weekday operator++(int) noexcept; constexpr weekday& operator--() noexcept; constexpr weekday operator--(int) noexcept; constexpr weekday& operator+=(const days& d) noexcept; constexpr weekday& operator-=(const days& d) noexcept; constexpr unsigned c_encoding() const noexcept; constexpr unsigned iso_encoding() const noexcept; constexpr bool ok() const noexcept; constexpr weekday_indexed operator[](unsigned index) const noexcept; constexpr weekday_last operator[](last_spec) const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4925)
|
||||
|
||||
weekday represents a day of the week in the civil calendar[.](#overview-1.sentence-1)
|
||||
|
||||
It normally holds values in the range 0 to 6,
|
||||
corresponding to Sunday through Saturday, but
|
||||
it may hold non-negative values outside this range[.](#overview-1.sentence-2)
|
||||
|
||||
It can be constructed with any unsigned value,
|
||||
which will be subsequently truncated to fit into weekday's unspecified internal storage[.](#overview-1.sentence-3)
|
||||
|
||||
weekday meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#overview-1.sentence-4)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
weekday is not[*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") because there is no universal consensus on which day is the first day of the week[.](#overview-1.sentence-5)
|
||||
|
||||
weekday's arithmetic operations treat the days of the week as a circular range,
|
||||
with no beginning and no end[.](#overview-1.sentence-6)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4941)
|
||||
|
||||
weekday is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.6.2](#members) Member functions [[time.cal.wd.members]](time.cal.wd.members)
|
||||
|
||||
[ð](#lib:weekday,constructor)
|
||||
|
||||
`constexpr explicit weekday(unsigned wd) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4952)
|
||||
|
||||
*Effects*: Initializes wd_ with wd == 7 ? 0 : wd[.](#members-1.sentence-1)
|
||||
|
||||
The value held is unspecified if wd is not in the range [0, 255][.](#members-1.sentence-2)
|
||||
|
||||
[ð](#lib:weekday,constructor_)
|
||||
|
||||
`constexpr weekday(const sys_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4964)
|
||||
|
||||
*Effects*: Computes what day of the week corresponds to the sys_days dp,
|
||||
and initializes that day of the week in wd_[.](#members-2.sentence-1)
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4969)
|
||||
|
||||
[*Example [1](#members-example-1)*:
|
||||
|
||||
If dp represents 1970-01-01,
|
||||
the constructed weekday represents Thursday
|
||||
by storing 4 in wd_[.](#members-3.sentence-1)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:weekday,constructor__)
|
||||
|
||||
`constexpr explicit weekday(const local_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4983)
|
||||
|
||||
*Effects*: Computes what day of the week corresponds to the local_days dp,
|
||||
and initializes that day of the week in wd_[.](#members-4.sentence-1)
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4988)
|
||||
|
||||
*Postconditions*: The value is identical to that constructed fromsys_days{dp.time_since_epoch()}[.](#members-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,weekday)
|
||||
|
||||
`constexpr weekday& operator++() noexcept;
|
||||
`
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5000)
|
||||
|
||||
*Effects*: *this += days{1}[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5004)
|
||||
|
||||
*Returns*: *this[.](#members-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,weekday_)
|
||||
|
||||
`constexpr weekday operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5015)
|
||||
|
||||
*Effects*: ++(*this)[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5019)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,weekday)
|
||||
|
||||
`constexpr weekday& operator--() noexcept;
|
||||
`
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5030)
|
||||
|
||||
*Effects*: *this -= days{1}[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5034)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,weekday_)
|
||||
|
||||
`constexpr weekday operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5045)
|
||||
|
||||
*Effects*: --(*this)[.](#members-12.sentence-1)
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5049)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,weekday)
|
||||
|
||||
`constexpr weekday& operator+=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5060)
|
||||
|
||||
*Effects*: *this = *this + d[.](#members-14.sentence-1)
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5064)
|
||||
|
||||
*Returns*: *this[.](#members-15.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,weekday)
|
||||
|
||||
`constexpr weekday& operator-=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[16](#members-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5075)
|
||||
|
||||
*Effects*: *this = *this - d[.](#members-16.sentence-1)
|
||||
|
||||
[17](#members-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5079)
|
||||
|
||||
*Returns*: *this[.](#members-17.sentence-1)
|
||||
|
||||
[ð](#lib:c_encoding,weekday)
|
||||
|
||||
`constexpr unsigned c_encoding() const noexcept;
|
||||
`
|
||||
|
||||
[18](#members-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5090)
|
||||
|
||||
*Returns*: wd_[.](#members-18.sentence-1)
|
||||
|
||||
[ð](#lib:iso_encoding,weekday)
|
||||
|
||||
`constexpr unsigned iso_encoding() const noexcept;
|
||||
`
|
||||
|
||||
[19](#members-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5101)
|
||||
|
||||
*Returns*: wd_ == 0u ? 7u : wd_[.](#members-19.sentence-1)
|
||||
|
||||
[ð](#lib:ok,weekday)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[20](#members-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5112)
|
||||
|
||||
*Returns*: wd_ <= 6[.](#members-20.sentence-1)
|
||||
|
||||
[ð](#lib:operator%5b%5d,weekday)
|
||||
|
||||
`constexpr weekday_indexed operator[](unsigned index) const noexcept;
|
||||
`
|
||||
|
||||
[21](#members-21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5123)
|
||||
|
||||
*Returns*: {*this, index}[.](#members-21.sentence-1)
|
||||
|
||||
[ð](#lib:operator%5b%5d,weekday_)
|
||||
|
||||
`constexpr weekday_last operator[](last_spec) const noexcept;
|
||||
`
|
||||
|
||||
[22](#members-22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5134)
|
||||
|
||||
*Returns*: weekday_last{*this}[.](#members-22.sentence-1)
|
||||
|
||||
#### [30.8.6.3](#nonmembers) Non-member functions [[time.cal.wd.nonmembers]](time.cal.wd.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,weekday)
|
||||
|
||||
`constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5147)
|
||||
|
||||
*Returns*: x.wd_ == y.wd_[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,weekday)
|
||||
|
||||
`constexpr weekday operator+(const weekday& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5158)
|
||||
|
||||
*Returns*: weekday{modulo(static_cast<long long>(x.wd_) + y.count(), 7)} where modulo(n, 7) computes the remainder of n divided by 7 using Euclidean division[.](#nonmembers-2.sentence-1)
|
||||
|
||||
[*Note [1](#nonmembers-note-1)*:
|
||||
|
||||
Given a divisor of 7, Euclidean division truncates towards negative infinity and
|
||||
always produces a remainder in the range of [0, 6][.](#nonmembers-2.sentence-2)
|
||||
|
||||
Assuming no overflow in the signed summation,
|
||||
this operation results in a weekday holding a value in the range [0, 6] even if !x.ok()[.](#nonmembers-2.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#nonmembers-example-1)*:
|
||||
|
||||
Monday + days{6} == Sunday[.](#nonmembers-2.sentence-4)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator+,weekday_)
|
||||
|
||||
`constexpr weekday operator+(const days& x, const weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5181)
|
||||
|
||||
*Returns*: y + x[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,weekday)
|
||||
|
||||
`constexpr weekday operator-(const weekday& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5192)
|
||||
|
||||
*Returns*: x + -y[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,weekday_)
|
||||
|
||||
`constexpr days operator-(const weekday& x, const weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5203)
|
||||
|
||||
*Returns*: If x.ok() == true and y.ok() == true,
|
||||
returns a value d in the range [days{0}, days{6}]
|
||||
satisfying y + d == x[.](#nonmembers-5.sentence-1)
|
||||
|
||||
Otherwise the value returned is unspecified[.](#nonmembers-5.sentence-2)
|
||||
|
||||
[*Example [2](#nonmembers-example-2)*:
|
||||
|
||||
Sunday - Monday == days{6}[.](#nonmembers-5.sentence-3)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator%3c%3c,weekday)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const weekday& wd);
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5224)
|
||||
|
||||
*Effects*: Equivalent to:return os << (wd.ok() ? format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%a}"), wd) : format(os.getloc(), *STATICALLY-WIDEN*<charT>("{} is not a valid weekday"), static_cast<unsigned>(wd.wd_)));
|
||||
|
||||
[ð](#lib:from_stream,weekday)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
weekday& wd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5245)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the weekday wd using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-7.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid weekday,is.setstate(ios_base::failbit) is called andwd is not modified[.](#nonmembers-7.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-7.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-7.sentence-4)
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5259)
|
||||
|
||||
*Returns*: is[.](#nonmembers-8.sentence-1)
|
||||
221
cppdraft/time/cal/wd/members.md
Normal file
221
cppdraft/time/cal/wd/members.md
Normal file
@@ -0,0 +1,221 @@
|
||||
[time.cal.wd.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wd.members)
|
||||
|
||||
### 30.8.6 Class weekday [[time.cal.wd]](time.cal.wd#members)
|
||||
|
||||
#### 30.8.6.2 Member functions [time.cal.wd.members]
|
||||
|
||||
[ð](#lib:weekday,constructor)
|
||||
|
||||
`constexpr explicit weekday(unsigned wd) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4952)
|
||||
|
||||
*Effects*: Initializes wd_ with wd == 7 ? 0 : wd[.](#1.sentence-1)
|
||||
|
||||
The value held is unspecified if wd is not in the range [0, 255][.](#1.sentence-2)
|
||||
|
||||
[ð](#lib:weekday,constructor_)
|
||||
|
||||
`constexpr weekday(const sys_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4964)
|
||||
|
||||
*Effects*: Computes what day of the week corresponds to the sys_days dp,
|
||||
and initializes that day of the week in wd_[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4969)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
If dp represents 1970-01-01,
|
||||
the constructed weekday represents Thursday
|
||||
by storing 4 in wd_[.](#3.sentence-1)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:weekday,constructor__)
|
||||
|
||||
`constexpr explicit weekday(const local_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4983)
|
||||
|
||||
*Effects*: Computes what day of the week corresponds to the local_days dp,
|
||||
and initializes that day of the week in wd_[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4988)
|
||||
|
||||
*Postconditions*: The value is identical to that constructed fromsys_days{dp.time_since_epoch()}[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,weekday)
|
||||
|
||||
`constexpr weekday& operator++() noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5000)
|
||||
|
||||
*Effects*: *this += days{1}[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5004)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,weekday_)
|
||||
|
||||
`constexpr weekday operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5015)
|
||||
|
||||
*Effects*: ++(*this)[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5019)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,weekday)
|
||||
|
||||
`constexpr weekday& operator--() noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5030)
|
||||
|
||||
*Effects*: *this -= days{1}[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5034)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,weekday_)
|
||||
|
||||
`constexpr weekday operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5045)
|
||||
|
||||
*Effects*: --(*this)[.](#12.sentence-1)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5049)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,weekday)
|
||||
|
||||
`constexpr weekday& operator+=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5060)
|
||||
|
||||
*Effects*: *this = *this + d[.](#14.sentence-1)
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5064)
|
||||
|
||||
*Returns*: *this[.](#15.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,weekday)
|
||||
|
||||
`constexpr weekday& operator-=(const days& d) noexcept;
|
||||
`
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5075)
|
||||
|
||||
*Effects*: *this = *this - d[.](#16.sentence-1)
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5079)
|
||||
|
||||
*Returns*: *this[.](#17.sentence-1)
|
||||
|
||||
[ð](#lib:c_encoding,weekday)
|
||||
|
||||
`constexpr unsigned c_encoding() const noexcept;
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5090)
|
||||
|
||||
*Returns*: wd_[.](#18.sentence-1)
|
||||
|
||||
[ð](#lib:iso_encoding,weekday)
|
||||
|
||||
`constexpr unsigned iso_encoding() const noexcept;
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5101)
|
||||
|
||||
*Returns*: wd_ == 0u ? 7u : wd_[.](#19.sentence-1)
|
||||
|
||||
[ð](#lib:ok,weekday)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5112)
|
||||
|
||||
*Returns*: wd_ <= 6[.](#20.sentence-1)
|
||||
|
||||
[ð](#lib:operator%5b%5d,weekday)
|
||||
|
||||
`constexpr weekday_indexed operator[](unsigned index) const noexcept;
|
||||
`
|
||||
|
||||
[21](#21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5123)
|
||||
|
||||
*Returns*: {*this, index}[.](#21.sentence-1)
|
||||
|
||||
[ð](#lib:operator%5b%5d,weekday_)
|
||||
|
||||
`constexpr weekday_last operator[](last_spec) const noexcept;
|
||||
`
|
||||
|
||||
[22](#22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5134)
|
||||
|
||||
*Returns*: weekday_last{*this}[.](#22.sentence-1)
|
||||
133
cppdraft/time/cal/wd/nonmembers.md
Normal file
133
cppdraft/time/cal/wd/nonmembers.md
Normal file
@@ -0,0 +1,133 @@
|
||||
[time.cal.wd.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wd.nonmembers)
|
||||
|
||||
### 30.8.6 Class weekday [[time.cal.wd]](time.cal.wd#nonmembers)
|
||||
|
||||
#### 30.8.6.3 Non-member functions [time.cal.wd.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,weekday)
|
||||
|
||||
`constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5147)
|
||||
|
||||
*Returns*: x.wd_ == y.wd_[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,weekday)
|
||||
|
||||
`constexpr weekday operator+(const weekday& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5158)
|
||||
|
||||
*Returns*: weekday{modulo(static_cast<long long>(x.wd_) + y.count(), 7)} where modulo(n, 7) computes the remainder of n divided by 7 using Euclidean division[.](#2.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Given a divisor of 7, Euclidean division truncates towards negative infinity and
|
||||
always produces a remainder in the range of [0, 6][.](#2.sentence-2)
|
||||
|
||||
Assuming no overflow in the signed summation,
|
||||
this operation results in a weekday holding a value in the range [0, 6] even if !x.ok()[.](#2.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
Monday + days{6} == Sunday[.](#2.sentence-4)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator+,weekday_)
|
||||
|
||||
`constexpr weekday operator+(const days& x, const weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5181)
|
||||
|
||||
*Returns*: y + x[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,weekday)
|
||||
|
||||
`constexpr weekday operator-(const weekday& x, const days& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5192)
|
||||
|
||||
*Returns*: x + -y[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,weekday_)
|
||||
|
||||
`constexpr days operator-(const weekday& x, const weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5203)
|
||||
|
||||
*Returns*: If x.ok() == true and y.ok() == true,
|
||||
returns a value d in the range [days{0}, days{6}]
|
||||
satisfying y + d == x[.](#5.sentence-1)
|
||||
|
||||
Otherwise the value returned is unspecified[.](#5.sentence-2)
|
||||
|
||||
[*Example [2](#example-2)*:
|
||||
|
||||
Sunday - Monday == days{6}[.](#5.sentence-3)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:operator%3c%3c,weekday)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const weekday& wd);
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5224)
|
||||
|
||||
*Effects*: Equivalent to:return os << (wd.ok() ? format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%a}"), wd) : format(os.getloc(), *STATICALLY-WIDEN*<charT>("{} is not a valid weekday"), static_cast<unsigned>(wd.wd_)));
|
||||
|
||||
[ð](#lib:from_stream,weekday)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
weekday& wd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5245)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the weekday wd using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#7.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid weekday,is.setstate(ios_base::failbit) is called andwd is not modified[.](#7.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#7.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#7.sentence-4)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5259)
|
||||
|
||||
*Returns*: is[.](#8.sentence-1)
|
||||
41
cppdraft/time/cal/wd/overview.md
Normal file
41
cppdraft/time/cal/wd/overview.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[time.cal.wd.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wd.overview)
|
||||
|
||||
### 30.8.6 Class weekday [[time.cal.wd]](time.cal.wd#overview)
|
||||
|
||||
#### 30.8.6.1 Overview [time.cal.wd.overview]
|
||||
|
||||
namespace std::chrono {class weekday {unsigned char wd_; // *exposition only*public: weekday() = default; constexpr explicit weekday(unsigned wd) noexcept; constexpr weekday(const sys_days& dp) noexcept; constexpr explicit weekday(const local_days& dp) noexcept; constexpr weekday& operator++() noexcept; constexpr weekday operator++(int) noexcept; constexpr weekday& operator--() noexcept; constexpr weekday operator--(int) noexcept; constexpr weekday& operator+=(const days& d) noexcept; constexpr weekday& operator-=(const days& d) noexcept; constexpr unsigned c_encoding() const noexcept; constexpr unsigned iso_encoding() const noexcept; constexpr bool ok() const noexcept; constexpr weekday_indexed operator[](unsigned index) const noexcept; constexpr weekday_last operator[](last_spec) const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4925)
|
||||
|
||||
weekday represents a day of the week in the civil calendar[.](#1.sentence-1)
|
||||
|
||||
It normally holds values in the range 0 to 6,
|
||||
corresponding to Sunday through Saturday, but
|
||||
it may hold non-negative values outside this range[.](#1.sentence-2)
|
||||
|
||||
It can be constructed with any unsigned value,
|
||||
which will be subsequently truncated to fit into weekday's unspecified internal storage[.](#1.sentence-3)
|
||||
|
||||
weekday meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#1.sentence-4)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
weekday is not[*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") because there is no universal consensus on which day is the first day of the week[.](#1.sentence-5)
|
||||
|
||||
weekday's arithmetic operations treat the days of the week as a circular range,
|
||||
with no beginning and no end[.](#1.sentence-6)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4941)
|
||||
|
||||
weekday is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
114
cppdraft/time/cal/wdidx.md
Normal file
114
cppdraft/time/cal/wdidx.md
Normal file
@@ -0,0 +1,114 @@
|
||||
[time.cal.wdidx]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdidx)
|
||||
|
||||
### 30.8.7 Class weekday_indexed [time.cal.wdidx]
|
||||
|
||||
#### [30.8.7.1](#overview) Overview [[time.cal.wdidx.overview]](time.cal.wdidx.overview)
|
||||
|
||||
namespace std::chrono {class weekday_indexed { chrono::weekday wd_; // *exposition only*unsigned char index_; // *exposition only*public: weekday_indexed() = default; constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr unsigned index() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5286)
|
||||
|
||||
weekday_indexed represents a weekday and a small index in the range 1 to 5[.](#overview-1.sentence-1)
|
||||
|
||||
This class is used to represent the
|
||||
first, second, third, fourth, or fifth weekday of a month[.](#overview-1.sentence-2)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5292)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
A weekday_indexed object
|
||||
can be constructed by indexing a weekday with an unsigned[.](#overview-2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#overview-example-1)*: constexpr auto wdi = Sunday[2]; // wdi is the second Sunday of an as yet unspecified monthstatic_assert(wdi.weekday() == Sunday);static_assert(wdi.index() == 2); â *end example*]
|
||||
|
||||
[3](#overview-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5306)
|
||||
|
||||
weekday_indexed is a trivially copyable and standard-layout class type[.](#overview-3.sentence-1)
|
||||
|
||||
#### [30.8.7.2](#members) Member functions [[time.cal.wdidx.members]](time.cal.wdidx.members)
|
||||
|
||||
[ð](#lib:weekday_indexed,constructor)
|
||||
|
||||
`constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5317)
|
||||
|
||||
*Effects*: Initializes wd_ with wd and index_ with index[.](#members-1.sentence-1)
|
||||
|
||||
The values held are unspecified if !wd.ok() or index is not in the range [0, 7][.](#members-1.sentence-2)
|
||||
|
||||
[ð](#lib:weekday,weekday_indexed)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5329)
|
||||
|
||||
*Returns*: wd_[.](#members-2.sentence-1)
|
||||
|
||||
[ð](#lib:index,weekday_indexed)
|
||||
|
||||
`constexpr unsigned index() const noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5340)
|
||||
|
||||
*Returns*: index_[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,weekday_indexed)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5351)
|
||||
|
||||
*Returns*: wd_.ok() && 1 <= index_ && index_ <= 5[.](#members-4.sentence-1)
|
||||
|
||||
#### [30.8.7.3](#nonmembers) Non-member functions [[time.cal.wdidx.nonmembers]](time.cal.wdidx.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,weekday_indexed)
|
||||
|
||||
`constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5364)
|
||||
|
||||
*Returns*: x.weekday() == y.weekday() && x.index() == y.index()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,weekday_indexed)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi);
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5377)
|
||||
|
||||
*Effects*: Equivalent to:auto i = wdi.index();return os << (i >= 1 && i <= 5 ? format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}[{}]"), wdi.weekday(), i) : format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}[{} is not a valid index]"),
|
||||
wdi.weekday(), i));
|
||||
55
cppdraft/time/cal/wdidx/members.md
Normal file
55
cppdraft/time/cal/wdidx/members.md
Normal file
@@ -0,0 +1,55 @@
|
||||
[time.cal.wdidx.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdidx.members)
|
||||
|
||||
### 30.8.7 Class weekday_indexed [[time.cal.wdidx]](time.cal.wdidx#members)
|
||||
|
||||
#### 30.8.7.2 Member functions [time.cal.wdidx.members]
|
||||
|
||||
[ð](#lib:weekday_indexed,constructor)
|
||||
|
||||
`constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5317)
|
||||
|
||||
*Effects*: Initializes wd_ with wd and index_ with index[.](#1.sentence-1)
|
||||
|
||||
The values held are unspecified if !wd.ok() or index is not in the range [0, 7][.](#1.sentence-2)
|
||||
|
||||
[ð](#lib:weekday,weekday_indexed)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5329)
|
||||
|
||||
*Returns*: wd_[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:index,weekday_indexed)
|
||||
|
||||
`constexpr unsigned index() const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5340)
|
||||
|
||||
*Returns*: index_[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:ok,weekday_indexed)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5351)
|
||||
|
||||
*Returns*: wd_.ok() && 1 <= index_ && index_ <= 5[.](#4.sentence-1)
|
||||
34
cppdraft/time/cal/wdidx/nonmembers.md
Normal file
34
cppdraft/time/cal/wdidx/nonmembers.md
Normal file
@@ -0,0 +1,34 @@
|
||||
[time.cal.wdidx.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdidx.nonmembers)
|
||||
|
||||
### 30.8.7 Class weekday_indexed [[time.cal.wdidx]](time.cal.wdidx#nonmembers)
|
||||
|
||||
#### 30.8.7.3 Non-member functions [time.cal.wdidx.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,weekday_indexed)
|
||||
|
||||
`constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5364)
|
||||
|
||||
*Returns*: x.weekday() == y.weekday() && x.index() == y.index()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,weekday_indexed)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5377)
|
||||
|
||||
*Effects*: Equivalent to:auto i = wdi.index();return os << (i >= 1 && i <= 5 ? format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}[{}]"), wdi.weekday(), i) : format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}[{} is not a valid index]"),
|
||||
wdi.weekday(), i));
|
||||
39
cppdraft/time/cal/wdidx/overview.md
Normal file
39
cppdraft/time/cal/wdidx/overview.md
Normal file
@@ -0,0 +1,39 @@
|
||||
[time.cal.wdidx.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdidx.overview)
|
||||
|
||||
### 30.8.7 Class weekday_indexed [[time.cal.wdidx]](time.cal.wdidx#overview)
|
||||
|
||||
#### 30.8.7.1 Overview [time.cal.wdidx.overview]
|
||||
|
||||
namespace std::chrono {class weekday_indexed { chrono::weekday wd_; // *exposition only*unsigned char index_; // *exposition only*public: weekday_indexed() = default; constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr unsigned index() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5286)
|
||||
|
||||
weekday_indexed represents a weekday and a small index in the range 1 to 5[.](#1.sentence-1)
|
||||
|
||||
This class is used to represent the
|
||||
first, second, third, fourth, or fifth weekday of a month[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5292)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A weekday_indexed object
|
||||
can be constructed by indexing a weekday with an unsigned[.](#2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#example-1)*: constexpr auto wdi = Sunday[2]; // wdi is the second Sunday of an as yet unspecified monthstatic_assert(wdi.weekday() == Sunday);static_assert(wdi.index() == 2); â *end example*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5306)
|
||||
|
||||
weekday_indexed is a trivially copyable and standard-layout class type[.](#3.sentence-1)
|
||||
97
cppdraft/time/cal/wdlast.md
Normal file
97
cppdraft/time/cal/wdlast.md
Normal file
@@ -0,0 +1,97 @@
|
||||
[time.cal.wdlast]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdlast)
|
||||
|
||||
### 30.8.8 Class weekday_last [time.cal.wdlast]
|
||||
|
||||
#### [30.8.8.1](#overview) Overview [[time.cal.wdlast.overview]](time.cal.wdlast.overview)
|
||||
|
||||
namespace std::chrono {class weekday_last { chrono::weekday wd_; // *exposition only*public:constexpr explicit weekday_last(const chrono::weekday& wd) noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5408)
|
||||
|
||||
weekday_last represents the last weekday of a month[.](#overview-1.sentence-1)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5411)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
A weekday_last object
|
||||
can be constructed by indexing a weekday with last[.](#overview-2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#overview-example-1)*: constexpr auto wdl = Sunday[last]; // wdl is the last Sunday of an as yet unspecified monthstatic_assert(wdl.weekday() == Sunday); â *end example*]
|
||||
|
||||
[3](#overview-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5423)
|
||||
|
||||
weekday_last is a trivially copyable and standard-layout class type[.](#overview-3.sentence-1)
|
||||
|
||||
#### [30.8.8.2](#members) Member functions [[time.cal.wdlast.members]](time.cal.wdlast.members)
|
||||
|
||||
[ð](#lib:weekday_last,constructor)
|
||||
|
||||
`constexpr explicit weekday_last(const chrono::weekday& wd) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5434)
|
||||
|
||||
*Effects*: Initializes wd_ with wd[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_last,weekday)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5445)
|
||||
|
||||
*Returns*: wd_[.](#members-2.sentence-1)
|
||||
|
||||
[ð](#lib:ok,weekday_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5456)
|
||||
|
||||
*Returns*: wd_.ok()[.](#members-3.sentence-1)
|
||||
|
||||
#### [30.8.8.3](#nonmembers) Non-member functions [[time.cal.wdlast.nonmembers]](time.cal.wdlast.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,weekday_last)
|
||||
|
||||
`constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5469)
|
||||
|
||||
*Returns*: x.weekday() == y.weekday()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,weekday_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl);
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5482)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}[last]"), wdl.weekday());
|
||||
42
cppdraft/time/cal/wdlast/members.md
Normal file
42
cppdraft/time/cal/wdlast/members.md
Normal file
@@ -0,0 +1,42 @@
|
||||
[time.cal.wdlast.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdlast.members)
|
||||
|
||||
### 30.8.8 Class weekday_last [[time.cal.wdlast]](time.cal.wdlast#members)
|
||||
|
||||
#### 30.8.8.2 Member functions [time.cal.wdlast.members]
|
||||
|
||||
[ð](#lib:weekday_last,constructor)
|
||||
|
||||
`constexpr explicit weekday_last(const chrono::weekday& wd) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5434)
|
||||
|
||||
*Effects*: Initializes wd_ with wd[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_last,weekday)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5445)
|
||||
|
||||
*Returns*: wd_[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:ok,weekday_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5456)
|
||||
|
||||
*Returns*: wd_.ok()[.](#3.sentence-1)
|
||||
33
cppdraft/time/cal/wdlast/nonmembers.md
Normal file
33
cppdraft/time/cal/wdlast/nonmembers.md
Normal file
@@ -0,0 +1,33 @@
|
||||
[time.cal.wdlast.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdlast.nonmembers)
|
||||
|
||||
### 30.8.8 Class weekday_last [[time.cal.wdlast]](time.cal.wdlast#nonmembers)
|
||||
|
||||
#### 30.8.8.3 Non-member functions [time.cal.wdlast.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,weekday_last)
|
||||
|
||||
`constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5469)
|
||||
|
||||
*Returns*: x.weekday() == y.weekday()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,weekday_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5482)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}[last]"), wdl.weekday());
|
||||
36
cppdraft/time/cal/wdlast/overview.md
Normal file
36
cppdraft/time/cal/wdlast/overview.md
Normal file
@@ -0,0 +1,36 @@
|
||||
[time.cal.wdlast.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#wdlast.overview)
|
||||
|
||||
### 30.8.8 Class weekday_last [[time.cal.wdlast]](time.cal.wdlast#overview)
|
||||
|
||||
#### 30.8.8.1 Overview [time.cal.wdlast.overview]
|
||||
|
||||
namespace std::chrono {class weekday_last { chrono::weekday wd_; // *exposition only*public:constexpr explicit weekday_last(const chrono::weekday& wd) noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5408)
|
||||
|
||||
weekday_last represents the last weekday of a month[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5411)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A weekday_last object
|
||||
can be constructed by indexing a weekday with last[.](#2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#example-1)*: constexpr auto wdl = Sunday[last]; // wdl is the last Sunday of an as yet unspecified monthstatic_assert(wdl.weekday() == Sunday); â *end example*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5423)
|
||||
|
||||
weekday_last is a trivially copyable and standard-layout class type[.](#3.sentence-1)
|
||||
349
cppdraft/time/cal/year.md
Normal file
349
cppdraft/time/cal/year.md
Normal file
@@ -0,0 +1,349 @@
|
||||
[time.cal.year]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#year)
|
||||
|
||||
### 30.8.5 Class year [time.cal.year]
|
||||
|
||||
#### [30.8.5.1](#overview) Overview [[time.cal.year.overview]](time.cal.year.overview)
|
||||
|
||||
namespace std::chrono {class year {short y_; // *exposition only*public: year() = default; constexpr explicit year(int y) noexcept; constexpr year& operator++() noexcept; constexpr year operator++(int) noexcept; constexpr year& operator--() noexcept; constexpr year operator--(int) noexcept; constexpr year& operator+=(const years& y) noexcept; constexpr year& operator-=(const years& y) noexcept; constexpr year operator+() const noexcept; constexpr year operator-() const noexcept; constexpr bool is_leap() const noexcept; constexpr explicit operator int() const noexcept; constexpr bool ok() const noexcept; static constexpr year min() noexcept; static constexpr year max() noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4572)
|
||||
|
||||
year represents a year in the civil calendar[.](#overview-1.sentence-1)
|
||||
|
||||
It can represent values in the range [min(), max()][.](#overview-1.sentence-2)
|
||||
|
||||
It can be constructed with any int value,
|
||||
which will be subsequently truncated to fit into year's unspecified internal storage[.](#overview-1.sentence-3)
|
||||
|
||||
year meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements,
|
||||
and participates in basic arithmetic with years objects,
|
||||
which represent a difference between two year objects[.](#overview-1.sentence-4)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4582)
|
||||
|
||||
year is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.5.2](#members) Member functions [[time.cal.year.members]](time.cal.year.members)
|
||||
|
||||
[ð](#lib:year,constructor)
|
||||
|
||||
`constexpr explicit year(int y) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4593)
|
||||
|
||||
*Effects*: Initializes y_ with y[.](#members-1.sentence-1)
|
||||
|
||||
The value held is unspecified if y is not in the range [-32767, 32767][.](#members-1.sentence-2)
|
||||
|
||||
[ð](#lib:operator++,year)
|
||||
|
||||
`constexpr year& operator++() noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4605)
|
||||
|
||||
*Effects*: ++y_[.](#members-2.sentence-1)
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4609)
|
||||
|
||||
*Returns*: *this[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,year_)
|
||||
|
||||
`constexpr year operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4620)
|
||||
|
||||
*Effects*: ++(*this)[.](#members-4.sentence-1)
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4624)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,year)
|
||||
|
||||
`constexpr year& operator--() noexcept;
|
||||
`
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4635)
|
||||
|
||||
*Effects*: --y_[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4639)
|
||||
|
||||
*Returns*: *this[.](#members-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,year_)
|
||||
|
||||
`constexpr year operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4650)
|
||||
|
||||
*Effects*: --(*this)[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4654)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#members-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year)
|
||||
|
||||
`constexpr year& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4665)
|
||||
|
||||
*Effects*: *this = *this + y[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4669)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year)
|
||||
|
||||
`constexpr year& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4680)
|
||||
|
||||
*Effects*: *this = *this - y[.](#members-12.sentence-1)
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4684)
|
||||
|
||||
*Returns*: *this[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year)
|
||||
|
||||
`constexpr year operator+() const noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4695)
|
||||
|
||||
*Returns*: *this[.](#members-14.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year)
|
||||
|
||||
`constexpr year operator-() const noexcept;
|
||||
`
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4706)
|
||||
|
||||
*Returns*: year{-y_}[.](#members-15.sentence-1)
|
||||
|
||||
[ð](#lib:is_leap,year)
|
||||
|
||||
`constexpr bool is_leap() const noexcept;
|
||||
`
|
||||
|
||||
[16](#members-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4717)
|
||||
|
||||
*Returns*: y_ % 4 == 0 && (y_ % 100 != 0 || y_ % 400 == 0)[.](#members-16.sentence-1)
|
||||
|
||||
[ð](#lib:operator_int,year)
|
||||
|
||||
`constexpr explicit operator int() const noexcept;
|
||||
`
|
||||
|
||||
[17](#members-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4728)
|
||||
|
||||
*Returns*: y_[.](#members-17.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[18](#members-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4739)
|
||||
|
||||
*Returns*: min().y_ <= y_ && y_ <= max().y_[.](#members-18.sentence-1)
|
||||
|
||||
[ð](#lib:min,year)
|
||||
|
||||
`static constexpr year min() noexcept;
|
||||
`
|
||||
|
||||
[19](#members-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4750)
|
||||
|
||||
*Returns*: year{-32767}[.](#members-19.sentence-1)
|
||||
|
||||
[ð](#lib:max,year)
|
||||
|
||||
`static constexpr year max() noexcept;
|
||||
`
|
||||
|
||||
[20](#members-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4761)
|
||||
|
||||
*Returns*: year{32767}[.](#members-20.sentence-1)
|
||||
|
||||
#### [30.8.5.3](#nonmembers) Non-member functions [[time.cal.year.nonmembers]](time.cal.year.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,year)
|
||||
|
||||
`constexpr bool operator==(const year& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4774)
|
||||
|
||||
*Returns*: int{x} == int{y}[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4785)
|
||||
|
||||
*Returns*: int{x} <=> int{y}[.](#nonmembers-2.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_)
|
||||
|
||||
`constexpr year operator+(const year& x, const years& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4796)
|
||||
|
||||
*Returns*: year{int{x} + static_cast<int>(y.count())}[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year__)
|
||||
|
||||
`constexpr year operator+(const years& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4807)
|
||||
|
||||
*Returns*: y + x[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_)
|
||||
|
||||
`constexpr year operator-(const year& x, const years& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4818)
|
||||
|
||||
*Returns*: x + -y[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year__)
|
||||
|
||||
`constexpr years operator-(const year& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4829)
|
||||
|
||||
*Returns*: years{int{x} - int{y}}[.](#nonmembers-6.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year& y);
|
||||
`
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4842)
|
||||
|
||||
*Effects*: Equivalent to:return os << (y.ok() ? format(*STATICALLY-WIDEN*<charT>("{:%Y}"), y) : format(*STATICALLY-WIDEN*<charT>("{:%Y} is not a valid year"), y));
|
||||
|
||||
[ð](#lib:from_stream,year)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
year& y, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4862)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the year y using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-8.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid year,is.setstate(ios_base::failbit) is called andy is not modified[.](#nonmembers-8.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-8.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-8.sentence-4)
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4876)
|
||||
|
||||
*Returns*: is[.](#nonmembers-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22y,year)
|
||||
|
||||
`constexpr chrono::year operator""y(unsigned long long y) noexcept;
|
||||
`
|
||||
|
||||
[10](#nonmembers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4887)
|
||||
|
||||
*Returns*: year{static_cast<int>(y)}[.](#nonmembers-10.sentence-1)
|
||||
201
cppdraft/time/cal/year/members.md
Normal file
201
cppdraft/time/cal/year/members.md
Normal file
@@ -0,0 +1,201 @@
|
||||
[time.cal.year.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#year.members)
|
||||
|
||||
### 30.8.5 Class year [[time.cal.year]](time.cal.year#members)
|
||||
|
||||
#### 30.8.5.2 Member functions [time.cal.year.members]
|
||||
|
||||
[ð](#lib:year,constructor)
|
||||
|
||||
`constexpr explicit year(int y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4593)
|
||||
|
||||
*Effects*: Initializes y_ with y[.](#1.sentence-1)
|
||||
|
||||
The value held is unspecified if y is not in the range [-32767, 32767][.](#1.sentence-2)
|
||||
|
||||
[ð](#lib:operator++,year)
|
||||
|
||||
`constexpr year& operator++() noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4605)
|
||||
|
||||
*Effects*: ++y_[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4609)
|
||||
|
||||
*Returns*: *this[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,year_)
|
||||
|
||||
`constexpr year operator++(int) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4620)
|
||||
|
||||
*Effects*: ++(*this)[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4624)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,year)
|
||||
|
||||
`constexpr year& operator--() noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4635)
|
||||
|
||||
*Effects*: --y_[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4639)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,year_)
|
||||
|
||||
`constexpr year operator--(int) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4650)
|
||||
|
||||
*Effects*: --(*this)[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4654)
|
||||
|
||||
*Returns*: A copy of *this as it existed on entry to this member function[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year)
|
||||
|
||||
`constexpr year& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4665)
|
||||
|
||||
*Effects*: *this = *this + y[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4669)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year)
|
||||
|
||||
`constexpr year& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4680)
|
||||
|
||||
*Effects*: *this = *this - y[.](#12.sentence-1)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4684)
|
||||
|
||||
*Returns*: *this[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year)
|
||||
|
||||
`constexpr year operator+() const noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4695)
|
||||
|
||||
*Returns*: *this[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year)
|
||||
|
||||
`constexpr year operator-() const noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4706)
|
||||
|
||||
*Returns*: year{-y_}[.](#15.sentence-1)
|
||||
|
||||
[ð](#lib:is_leap,year)
|
||||
|
||||
`constexpr bool is_leap() const noexcept;
|
||||
`
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4717)
|
||||
|
||||
*Returns*: y_ % 4 == 0 && (y_ % 100 != 0 || y_ % 400 == 0)[.](#16.sentence-1)
|
||||
|
||||
[ð](#lib:operator_int,year)
|
||||
|
||||
`constexpr explicit operator int() const noexcept;
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4728)
|
||||
|
||||
*Returns*: y_[.](#17.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4739)
|
||||
|
||||
*Returns*: min().y_ <= y_ && y_ <= max().y_[.](#18.sentence-1)
|
||||
|
||||
[ð](#lib:min,year)
|
||||
|
||||
`static constexpr year min() noexcept;
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4750)
|
||||
|
||||
*Returns*: year{-32767}[.](#19.sentence-1)
|
||||
|
||||
[ð](#lib:max,year)
|
||||
|
||||
`static constexpr year max() noexcept;
|
||||
`
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4761)
|
||||
|
||||
*Returns*: year{32767}[.](#20.sentence-1)
|
||||
129
cppdraft/time/cal/year/nonmembers.md
Normal file
129
cppdraft/time/cal/year/nonmembers.md
Normal file
@@ -0,0 +1,129 @@
|
||||
[time.cal.year.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#year.nonmembers)
|
||||
|
||||
### 30.8.5 Class year [[time.cal.year]](time.cal.year#nonmembers)
|
||||
|
||||
#### 30.8.5.3 Non-member functions [time.cal.year.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,year)
|
||||
|
||||
`constexpr bool operator==(const year& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4774)
|
||||
|
||||
*Returns*: int{x} == int{y}[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4785)
|
||||
|
||||
*Returns*: int{x} <=> int{y}[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year)
|
||||
|
||||
`constexpr year operator+(const year& x, const years& y) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4796)
|
||||
|
||||
*Returns*: year{int{x} + static_cast<int>(y.count())}[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_)
|
||||
|
||||
`constexpr year operator+(const years& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4807)
|
||||
|
||||
*Returns*: y + x[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year)
|
||||
|
||||
`constexpr year operator-(const year& x, const years& y) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4818)
|
||||
|
||||
*Returns*: x + -y[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_)
|
||||
|
||||
`constexpr years operator-(const year& x, const year& y) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4829)
|
||||
|
||||
*Returns*: years{int{x} - int{y}}[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year& y);
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4842)
|
||||
|
||||
*Effects*: Equivalent to:return os << (y.ok() ? format(*STATICALLY-WIDEN*<charT>("{:%Y}"), y) : format(*STATICALLY-WIDEN*<charT>("{:%Y} is not a valid year"), y));
|
||||
|
||||
[ð](#lib:from_stream,year)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
year& y, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4862)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the year y using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#8.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid year,is.setstate(ios_base::failbit) is called andy is not modified[.](#8.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#8.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#8.sentence-4)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4876)
|
||||
|
||||
*Returns*: is[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22y,year)
|
||||
|
||||
`constexpr chrono::year operator""y(unsigned long long y) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4887)
|
||||
|
||||
*Returns*: year{static_cast<int>(y)}[.](#10.sentence-1)
|
||||
33
cppdraft/time/cal/year/overview.md
Normal file
33
cppdraft/time/cal/year/overview.md
Normal file
@@ -0,0 +1,33 @@
|
||||
[time.cal.year.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#year.overview)
|
||||
|
||||
### 30.8.5 Class year [[time.cal.year]](time.cal.year#overview)
|
||||
|
||||
#### 30.8.5.1 Overview [time.cal.year.overview]
|
||||
|
||||
namespace std::chrono {class year {short y_; // *exposition only*public: year() = default; constexpr explicit year(int y) noexcept; constexpr year& operator++() noexcept; constexpr year operator++(int) noexcept; constexpr year& operator--() noexcept; constexpr year operator--(int) noexcept; constexpr year& operator+=(const years& y) noexcept; constexpr year& operator-=(const years& y) noexcept; constexpr year operator+() const noexcept; constexpr year operator-() const noexcept; constexpr bool is_leap() const noexcept; constexpr explicit operator int() const noexcept; constexpr bool ok() const noexcept; static constexpr year min() noexcept; static constexpr year max() noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4572)
|
||||
|
||||
year represents a year in the civil calendar[.](#1.sentence-1)
|
||||
|
||||
It can represent values in the range [min(), max()][.](#1.sentence-2)
|
||||
|
||||
It can be constructed with any int value,
|
||||
which will be subsequently truncated to fit into year's unspecified internal storage[.](#1.sentence-3)
|
||||
|
||||
year meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements,
|
||||
and participates in basic arithmetic with years objects,
|
||||
which represent a difference between two year objects[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4582)
|
||||
|
||||
year is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
334
cppdraft/time/cal/ym.md
Normal file
334
cppdraft/time/cal/ym.md
Normal file
@@ -0,0 +1,334 @@
|
||||
[time.cal.ym]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ym)
|
||||
|
||||
### 30.8.13 Class year_month [time.cal.ym]
|
||||
|
||||
#### [30.8.13.1](#overview) Overview [[time.cal.ym.overview]](time.cal.ym.overview)
|
||||
|
||||
namespace std::chrono {class year_month { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only*public: year_month() = default; constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr year_month& operator+=(const months& dm) noexcept; constexpr year_month& operator-=(const months& dm) noexcept; constexpr year_month& operator+=(const years& dy) noexcept; constexpr year_month& operator-=(const years& dy) noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6012)
|
||||
|
||||
year_month represents a specific month of a specific year,
|
||||
but with an unspecified day[.](#overview-1.sentence-1)
|
||||
|
||||
year_month is a field-based time point with a resolution of months[.](#overview-1.sentence-2)
|
||||
|
||||
year_month meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#overview-1.sentence-3)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6019)
|
||||
|
||||
year_month is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.13.2](#members) Member functions [[time.cal.ym.members]](time.cal.ym.members)
|
||||
|
||||
[ð](#lib:year_month,constructor)
|
||||
|
||||
`constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6030)
|
||||
|
||||
*Effects*: Initializes y_ with y, and m_ with m[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6041)
|
||||
|
||||
*Returns*: y_[.](#members-2.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6052)
|
||||
|
||||
*Returns*: m_[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month)
|
||||
|
||||
`constexpr year_month& operator+=(const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6063)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-4.sentence-1)
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6071)
|
||||
|
||||
*Effects*: *this = *this + dm[.](#members-5.sentence-1)
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6075)
|
||||
|
||||
*Returns*: *this[.](#members-6.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month)
|
||||
|
||||
`constexpr year_month& operator-=(const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6086)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-7.sentence-1)
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6094)
|
||||
|
||||
*Effects*: *this = *this - dm[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6098)
|
||||
|
||||
*Returns*: *this[.](#members-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_)
|
||||
|
||||
`constexpr year_month& operator+=(const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6109)
|
||||
|
||||
*Effects*: *this = *this + dy[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6113)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_)
|
||||
|
||||
`constexpr year_month& operator-=(const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6124)
|
||||
|
||||
*Effects*: *this = *this - dy[.](#members-12.sentence-1)
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6128)
|
||||
|
||||
*Returns*: *this[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6139)
|
||||
|
||||
*Returns*: y_.ok() && m_.ok()[.](#members-14.sentence-1)
|
||||
|
||||
#### [30.8.13.3](#nonmembers) Non-member functions [[time.cal.ym.nonmembers]](time.cal.ym.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,year_month)
|
||||
|
||||
`constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6152)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year_month)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year_month& x, const year_month& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6163)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;return x.month() <=> y.month();
|
||||
|
||||
[ð](#lib:operator+,year_month)
|
||||
|
||||
`constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6178)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6186)
|
||||
|
||||
*Returns*: A year_month value z such that z.ok() && z - ym == dm is true[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6191)
|
||||
|
||||
*Complexity*: O(1) with respect to the value of dm[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_)
|
||||
|
||||
`constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6202)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-6.sentence-1)
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6210)
|
||||
|
||||
*Returns*: ym + dm[.](#nonmembers-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month)
|
||||
|
||||
`constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6221)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-8.sentence-1)
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6229)
|
||||
|
||||
*Returns*: ym + -dm[.](#nonmembers-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_)
|
||||
|
||||
`constexpr months operator-(const year_month& x, const year_month& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#nonmembers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6240)
|
||||
|
||||
*Returns*: x.year() - y.year() + months{static_cast<int>(unsigned{x.month()}) -static_cast<int>(unsigned{y.month()})}
|
||||
|
||||
[ð](#lib:operator+,year_month__)
|
||||
|
||||
`constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[11](#nonmembers-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6254)
|
||||
|
||||
*Returns*: (ym.year() + dy) / ym.month()[.](#nonmembers-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month___)
|
||||
|
||||
`constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
|
||||
`
|
||||
|
||||
[12](#nonmembers-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6265)
|
||||
|
||||
*Returns*: ym + dy[.](#nonmembers-12.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month__)
|
||||
|
||||
`constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[13](#nonmembers-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6276)
|
||||
|
||||
*Returns*: ym + -dy[.](#nonmembers-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month& ym);
|
||||
`
|
||||
|
||||
[14](#nonmembers-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6289)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}"),
|
||||
ym.year(), ym.month());
|
||||
|
||||
[ð](#lib:from_stream,year_month)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
year_month& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[15](#nonmembers-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6308)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the year_month ym using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-15.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid year_month,is.setstate(ios_base::failbit) is called andym is not modified[.](#nonmembers-15.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-15.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-15.sentence-4)
|
||||
|
||||
[16](#nonmembers-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6322)
|
||||
|
||||
*Returns*: is[.](#nonmembers-16.sentence-1)
|
||||
137
cppdraft/time/cal/ym/members.md
Normal file
137
cppdraft/time/cal/ym/members.md
Normal file
@@ -0,0 +1,137 @@
|
||||
[time.cal.ym.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ym.members)
|
||||
|
||||
### 30.8.13 Class year_month [[time.cal.ym]](time.cal.ym#members)
|
||||
|
||||
#### 30.8.13.2 Member functions [time.cal.ym.members]
|
||||
|
||||
[ð](#lib:year_month,constructor)
|
||||
|
||||
`constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6030)
|
||||
|
||||
*Effects*: Initializes y_ with y, and m_ with m[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6041)
|
||||
|
||||
*Returns*: y_[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6052)
|
||||
|
||||
*Returns*: m_[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month)
|
||||
|
||||
`constexpr year_month& operator+=(const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6063)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6071)
|
||||
|
||||
*Effects*: *this = *this + dm[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6075)
|
||||
|
||||
*Returns*: *this[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month)
|
||||
|
||||
`constexpr year_month& operator-=(const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6086)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6094)
|
||||
|
||||
*Effects*: *this = *this - dm[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6098)
|
||||
|
||||
*Returns*: *this[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_)
|
||||
|
||||
`constexpr year_month& operator+=(const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6109)
|
||||
|
||||
*Effects*: *this = *this + dy[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6113)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_)
|
||||
|
||||
`constexpr year_month& operator-=(const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6124)
|
||||
|
||||
*Effects*: *this = *this - dy[.](#12.sentence-1)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6128)
|
||||
|
||||
*Returns*: *this[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6139)
|
||||
|
||||
*Returns*: y_.ok() && m_.ok()[.](#14.sentence-1)
|
||||
182
cppdraft/time/cal/ym/nonmembers.md
Normal file
182
cppdraft/time/cal/ym/nonmembers.md
Normal file
@@ -0,0 +1,182 @@
|
||||
[time.cal.ym.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ym.nonmembers)
|
||||
|
||||
### 30.8.13 Class year_month [[time.cal.ym]](time.cal.ym#nonmembers)
|
||||
|
||||
#### 30.8.13.3 Non-member functions [time.cal.ym.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,year_month)
|
||||
|
||||
`constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6152)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year_month)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year_month& x, const year_month& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6163)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;return x.month() <=> y.month();
|
||||
|
||||
[ð](#lib:operator+,year_month)
|
||||
|
||||
`constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6178)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6186)
|
||||
|
||||
*Returns*: A year_month value z such that z.ok() && z - ym == dm is true[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6191)
|
||||
|
||||
*Complexity*: O(1) with respect to the value of dm[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_)
|
||||
|
||||
`constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6202)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6210)
|
||||
|
||||
*Returns*: ym + dm[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month)
|
||||
|
||||
`constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6221)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6229)
|
||||
|
||||
*Returns*: ym + -dm[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_)
|
||||
|
||||
`constexpr months operator-(const year_month& x, const year_month& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6240)
|
||||
|
||||
*Returns*: x.year() - y.year() + months{static_cast<int>(unsigned{x.month()}) -static_cast<int>(unsigned{y.month()})}
|
||||
|
||||
[ð](#lib:operator+,year_month__)
|
||||
|
||||
`constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6254)
|
||||
|
||||
*Returns*: (ym.year() + dy) / ym.month()[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month___)
|
||||
|
||||
`constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6265)
|
||||
|
||||
*Returns*: ym + dy[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month__)
|
||||
|
||||
`constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6276)
|
||||
|
||||
*Returns*: ym + -dy[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month& ym);
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6289)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}"),
|
||||
ym.year(), ym.month());
|
||||
|
||||
[ð](#lib:from_stream,year_month)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
year_month& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6308)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the year_month ym using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#15.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid year_month,is.setstate(ios_base::failbit) is called andym is not modified[.](#15.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#15.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#15.sentence-4)
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6322)
|
||||
|
||||
*Returns*: is[.](#16.sentence-1)
|
||||
29
cppdraft/time/cal/ym/overview.md
Normal file
29
cppdraft/time/cal/ym/overview.md
Normal file
@@ -0,0 +1,29 @@
|
||||
[time.cal.ym.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ym.overview)
|
||||
|
||||
### 30.8.13 Class year_month [[time.cal.ym]](time.cal.ym#overview)
|
||||
|
||||
#### 30.8.13.1 Overview [time.cal.ym.overview]
|
||||
|
||||
namespace std::chrono {class year_month { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only*public: year_month() = default; constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr year_month& operator+=(const months& dm) noexcept; constexpr year_month& operator-=(const months& dm) noexcept; constexpr year_month& operator+=(const years& dy) noexcept; constexpr year_month& operator-=(const years& dy) noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6012)
|
||||
|
||||
year_month represents a specific month of a specific year,
|
||||
but with an unspecified day[.](#1.sentence-1)
|
||||
|
||||
year_month is a field-based time point with a resolution of months[.](#1.sentence-2)
|
||||
|
||||
year_month meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6019)
|
||||
|
||||
year_month is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
450
cppdraft/time/cal/ymd.md
Normal file
450
cppdraft/time/cal/ymd.md
Normal file
@@ -0,0 +1,450 @@
|
||||
[time.cal.ymd]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymd)
|
||||
|
||||
### 30.8.14 Class year_month_day [time.cal.ymd]
|
||||
|
||||
#### [30.8.14.1](#overview) Overview [[time.cal.ymd.overview]](time.cal.ymd.overview)
|
||||
|
||||
namespace std::chrono {class year_month_day { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::day d_; // *exposition only*public: year_month_day() = default; constexpr year_month_day(const chrono::year& y, const chrono::month& m, const chrono::day& d) noexcept; constexpr year_month_day(const year_month_day_last& ymdl) noexcept; constexpr year_month_day(const sys_days& dp) noexcept; constexpr explicit year_month_day(const local_days& dp) noexcept; constexpr year_month_day& operator+=(const months& m) noexcept; constexpr year_month_day& operator-=(const months& m) noexcept; constexpr year_month_day& operator+=(const years& y) noexcept; constexpr year_month_day& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::day day() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6363)
|
||||
|
||||
year_month_day represents a specific year, month, and day[.](#overview-1.sentence-1)
|
||||
|
||||
year_month_day is a field-based time point with a resolution of days[.](#overview-1.sentence-2)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
year_month_day supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#overview-1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#overview-1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#overview-1.sentence-5)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6375)
|
||||
|
||||
year_month_day is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.14.2](#members) Member functions [[time.cal.ymd.members]](time.cal.ymd.members)
|
||||
|
||||
[ð](#lib:year_month_day,constructor)
|
||||
|
||||
`constexpr year_month_day(const chrono::year& y, const chrono::month& m,
|
||||
const chrono::day& d) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6387)
|
||||
|
||||
*Effects*: Initializesy_ with y,m_ with m, andd_ with d[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_day,constructor_)
|
||||
|
||||
`constexpr year_month_day(const year_month_day_last& ymdl) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6401)
|
||||
|
||||
*Effects*: Initializesy_ with ymdl.year(),m_ with ymdl.month(), andd_ with ymdl.day()[.](#members-2.sentence-1)
|
||||
|
||||
[*Note [1](#members-note-1)*:
|
||||
|
||||
This conversion from year_month_day_last to year_month_day can be more efficient than converting a year_month_day_last to a sys_days,
|
||||
and then converting that sys_days to a year_month_day[.](#members-2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:year_month_day,constructor__)
|
||||
|
||||
`constexpr year_month_day(const sys_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6420)
|
||||
|
||||
*Effects*: Constructs an object of type year_month_day that corresponds to the date represented by dp[.](#members-3.sentence-1)
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6425)
|
||||
|
||||
*Remarks*: For any value ymd of type year_month_day for which ymd.ok() is true,ymd == year_month_day{sys_days{ymd}} is true[.](#members-4.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_day,constructor___)
|
||||
|
||||
`constexpr explicit year_month_day(const local_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6439)
|
||||
|
||||
*Effects*: Equivalent to constructing with sys_days{dp.time_since_epoch()}[.](#members-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day)
|
||||
|
||||
`constexpr year_month_day& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6450)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6458)
|
||||
|
||||
*Effects*: *this = *this + m[.](#members-7.sentence-1)
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6462)
|
||||
|
||||
*Returns*: *this[.](#members-8.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day)
|
||||
|
||||
`constexpr year_month_day& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6473)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-9.sentence-1)
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6481)
|
||||
|
||||
*Effects*: *this = *this - m[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6485)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day_)
|
||||
|
||||
`constexpr year_month_day& year_month_day::operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6496)
|
||||
|
||||
*Effects*: *this = *this + y[.](#members-12.sentence-1)
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6500)
|
||||
|
||||
*Returns*: *this[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day_)
|
||||
|
||||
`constexpr year_month_day& year_month_day::operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6511)
|
||||
|
||||
*Effects*: *this = *this - y[.](#members-14.sentence-1)
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6515)
|
||||
|
||||
*Returns*: *this[.](#members-15.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_day)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[16](#members-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6526)
|
||||
|
||||
*Returns*: y_[.](#members-16.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_day)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[17](#members-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6537)
|
||||
|
||||
*Returns*: m_[.](#members-17.sentence-1)
|
||||
|
||||
[ð](#lib:day,year_month_day)
|
||||
|
||||
`constexpr chrono::day day() const noexcept;
|
||||
`
|
||||
|
||||
[18](#members-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6548)
|
||||
|
||||
*Returns*: d_[.](#members-18.sentence-1)
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_day)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[19](#members-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6559)
|
||||
|
||||
*Returns*: If ok(),
|
||||
returns a sys_days holding a count of days from the sys_days epoch to *this (a negative value if *this represents a date prior to the sys_days epoch)[.](#members-19.sentence-1)
|
||||
|
||||
Otherwise, if y_.ok() && m_.ok() is true,
|
||||
returns sys_days{y_/m_/1d} + (d_ - 1d)[.](#members-19.sentence-2)
|
||||
|
||||
Otherwise the value returned is unspecified[.](#members-19.sentence-3)
|
||||
|
||||
[20](#members-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6569)
|
||||
|
||||
*Remarks*: A sys_days in the range [days{-12687428}, days{11248737}]
|
||||
which is converted to a year_month_day has the same value when converted back to a sys_days[.](#members-20.sentence-1)
|
||||
|
||||
[21](#members-21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6575)
|
||||
|
||||
[*Example [1](#members-example-1)*: static_assert(year_month_day{sys_days{2017y/January/0}} == 2016y/December/31);static_assert(year_month_day{sys_days{2017y/January/31}} == 2017y/January/31);static_assert(year_month_day{sys_days{2017y/January/32}} == 2017y/February/1); â *end example*]
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_day)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[22](#members-22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6591)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#members-22.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_day)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[23](#members-23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6602)
|
||||
|
||||
*Returns*: If y_.ok() is true,
|
||||
and m_.ok() is true,
|
||||
and d_ is in the range [1d, (y_/m_/last).day()],
|
||||
then returns true; otherwise returns false[.](#members-23.sentence-1)
|
||||
|
||||
#### [30.8.14.3](#nonmembers) Non-member functions [[time.cal.ymd.nonmembers]](time.cal.ymd.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,year_month_day)
|
||||
|
||||
`constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6618)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month() && x.day() == y.day()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year_month_day)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6629)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;if (auto c = x.month() <=> y.month(); c != 0) return c;return x.day() <=> y.day();
|
||||
|
||||
[ð](#lib:operator+,year_month_day)
|
||||
|
||||
`constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6645)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6653)
|
||||
|
||||
*Returns*: (ymd.year() / ymd.month() + dm) / ymd.day()[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6657)
|
||||
|
||||
[*Note [1](#nonmembers-note-1)*:
|
||||
|
||||
If ymd.day() is in the range [1d, 28d],ok() will return true for
|
||||
the resultant year_month_day[.](#nonmembers-5.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator+,year_month_day_)
|
||||
|
||||
`constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept;
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6671)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-6.sentence-1)
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6679)
|
||||
|
||||
*Returns*: ymd + dm[.](#nonmembers-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day)
|
||||
|
||||
`constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6690)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-8.sentence-1)
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6698)
|
||||
|
||||
*Returns*: ymd + (-dm)[.](#nonmembers-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day__)
|
||||
|
||||
`constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#nonmembers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6709)
|
||||
|
||||
*Returns*: (ymd.year() + dy) / ymd.month() / ymd.day()[.](#nonmembers-10.sentence-1)
|
||||
|
||||
[11](#nonmembers-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6713)
|
||||
|
||||
[*Note [2](#nonmembers-note-2)*:
|
||||
|
||||
If ymd.month() is February
|
||||
and ymd.day() is not in the range [1d, 28d],ok() can return false for
|
||||
the resultant year_month_day[.](#nonmembers-11.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator+,year_month_day___)
|
||||
|
||||
`constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept;
|
||||
`
|
||||
|
||||
[12](#nonmembers-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6728)
|
||||
|
||||
*Returns*: ymd + dy[.](#nonmembers-12.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day_)
|
||||
|
||||
`constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[13](#nonmembers-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6739)
|
||||
|
||||
*Returns*: ymd + (-dy)[.](#nonmembers-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_day)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_day& ymd);
|
||||
`
|
||||
|
||||
[14](#nonmembers-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6752)
|
||||
|
||||
*Effects*: Equivalent to:return os << (ymd.ok() ? format(*STATICALLY-WIDEN*<charT>("{:%F}"), ymd) : format(*STATICALLY-WIDEN*<charT>("{:%F} is not a valid date"), ymd));
|
||||
|
||||
[ð](#lib:from_stream,year_month_day)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
year_month_day& ymd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[15](#nonmembers-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6772)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the year_month_day ymd using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-15.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid year_month_day,is.setstate(ios_base::failbit) is called andymd is not modified[.](#nonmembers-15.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-15.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-15.sentence-4)
|
||||
|
||||
[16](#nonmembers-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6786)
|
||||
|
||||
*Returns*: is[.](#nonmembers-16.sentence-1)
|
||||
239
cppdraft/time/cal/ymd/members.md
Normal file
239
cppdraft/time/cal/ymd/members.md
Normal file
@@ -0,0 +1,239 @@
|
||||
[time.cal.ymd.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymd.members)
|
||||
|
||||
### 30.8.14 Class year_month_day [[time.cal.ymd]](time.cal.ymd#members)
|
||||
|
||||
#### 30.8.14.2 Member functions [time.cal.ymd.members]
|
||||
|
||||
[ð](#lib:year_month_day,constructor)
|
||||
|
||||
`constexpr year_month_day(const chrono::year& y, const chrono::month& m,
|
||||
const chrono::day& d) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6387)
|
||||
|
||||
*Effects*: Initializesy_ with y,m_ with m, andd_ with d[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_day,constructor_)
|
||||
|
||||
`constexpr year_month_day(const year_month_day_last& ymdl) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6401)
|
||||
|
||||
*Effects*: Initializesy_ with ymdl.year(),m_ with ymdl.month(), andd_ with ymdl.day()[.](#2.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This conversion from year_month_day_last to year_month_day can be more efficient than converting a year_month_day_last to a sys_days,
|
||||
and then converting that sys_days to a year_month_day[.](#2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:year_month_day,constructor__)
|
||||
|
||||
`constexpr year_month_day(const sys_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6420)
|
||||
|
||||
*Effects*: Constructs an object of type year_month_day that corresponds to the date represented by dp[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6425)
|
||||
|
||||
*Remarks*: For any value ymd of type year_month_day for which ymd.ok() is true,ymd == year_month_day{sys_days{ymd}} is true[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_day,constructor___)
|
||||
|
||||
`constexpr explicit year_month_day(const local_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6439)
|
||||
|
||||
*Effects*: Equivalent to constructing with sys_days{dp.time_since_epoch()}[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day)
|
||||
|
||||
`constexpr year_month_day& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6450)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6458)
|
||||
|
||||
*Effects*: *this = *this + m[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6462)
|
||||
|
||||
*Returns*: *this[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day)
|
||||
|
||||
`constexpr year_month_day& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6473)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6481)
|
||||
|
||||
*Effects*: *this = *this - m[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6485)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day_)
|
||||
|
||||
`constexpr year_month_day& year_month_day::operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6496)
|
||||
|
||||
*Effects*: *this = *this + y[.](#12.sentence-1)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6500)
|
||||
|
||||
*Returns*: *this[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day_)
|
||||
|
||||
`constexpr year_month_day& year_month_day::operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6511)
|
||||
|
||||
*Effects*: *this = *this - y[.](#14.sentence-1)
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6515)
|
||||
|
||||
*Returns*: *this[.](#15.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_day)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6526)
|
||||
|
||||
*Returns*: y_[.](#16.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_day)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6537)
|
||||
|
||||
*Returns*: m_[.](#17.sentence-1)
|
||||
|
||||
[ð](#lib:day,year_month_day)
|
||||
|
||||
`constexpr chrono::day day() const noexcept;
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6548)
|
||||
|
||||
*Returns*: d_[.](#18.sentence-1)
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_day)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6559)
|
||||
|
||||
*Returns*: If ok(),
|
||||
returns a sys_days holding a count of days from the sys_days epoch to *this (a negative value if *this represents a date prior to the sys_days epoch)[.](#19.sentence-1)
|
||||
|
||||
Otherwise, if y_.ok() && m_.ok() is true,
|
||||
returns sys_days{y_/m_/1d} + (d_ - 1d)[.](#19.sentence-2)
|
||||
|
||||
Otherwise the value returned is unspecified[.](#19.sentence-3)
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6569)
|
||||
|
||||
*Remarks*: A sys_days in the range [days{-12687428}, days{11248737}]
|
||||
which is converted to a year_month_day has the same value when converted back to a sys_days[.](#20.sentence-1)
|
||||
|
||||
[21](#21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6575)
|
||||
|
||||
[*Example [1](#example-1)*: static_assert(year_month_day{sys_days{2017y/January/0}} == 2016y/December/31);static_assert(year_month_day{sys_days{2017y/January/31}} == 2017y/January/31);static_assert(year_month_day{sys_days{2017y/January/32}} == 2017y/February/1); â *end example*]
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_day)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[22](#22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6591)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#22.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_day)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[23](#23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6602)
|
||||
|
||||
*Returns*: If y_.ok() is true,
|
||||
and m_.ok() is true,
|
||||
and d_ is in the range [1d, (y_/m_/last).day()],
|
||||
then returns true; otherwise returns false[.](#23.sentence-1)
|
||||
187
cppdraft/time/cal/ymd/nonmembers.md
Normal file
187
cppdraft/time/cal/ymd/nonmembers.md
Normal file
@@ -0,0 +1,187 @@
|
||||
[time.cal.ymd.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymd.nonmembers)
|
||||
|
||||
### 30.8.14 Class year_month_day [[time.cal.ymd]](time.cal.ymd#nonmembers)
|
||||
|
||||
#### 30.8.14.3 Non-member functions [time.cal.ymd.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,year_month_day)
|
||||
|
||||
`constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6618)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month() && x.day() == y.day()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year_month_day)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6629)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;if (auto c = x.month() <=> y.month(); c != 0) return c;return x.day() <=> y.day();
|
||||
|
||||
[ð](#lib:operator+,year_month_day)
|
||||
|
||||
`constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6645)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6653)
|
||||
|
||||
*Returns*: (ymd.year() / ymd.month() + dm) / ymd.day()[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6657)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
If ymd.day() is in the range [1d, 28d],ok() will return true for
|
||||
the resultant year_month_day[.](#5.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator+,year_month_day_)
|
||||
|
||||
`constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6671)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6679)
|
||||
|
||||
*Returns*: ymd + dm[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day)
|
||||
|
||||
`constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6690)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6698)
|
||||
|
||||
*Returns*: ymd + (-dm)[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day__)
|
||||
|
||||
`constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6709)
|
||||
|
||||
*Returns*: (ymd.year() + dy) / ymd.month() / ymd.day()[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6713)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
If ymd.month() is February
|
||||
and ymd.day() is not in the range [1d, 28d],ok() can return false for
|
||||
the resultant year_month_day[.](#11.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator+,year_month_day___)
|
||||
|
||||
`constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6728)
|
||||
|
||||
*Returns*: ymd + dy[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day_)
|
||||
|
||||
`constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6739)
|
||||
|
||||
*Returns*: ymd + (-dy)[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_day)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_day& ymd);
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6752)
|
||||
|
||||
*Effects*: Equivalent to:return os << (ymd.ok() ? format(*STATICALLY-WIDEN*<charT>("{:%F}"), ymd) : format(*STATICALLY-WIDEN*<charT>("{:%F} is not a valid date"), ymd));
|
||||
|
||||
[ð](#lib:from_stream,year_month_day)
|
||||
|
||||
`template<class charT, class traits, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
year_month_day& ymd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6772)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the year_month_day ymd using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#15.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid year_month_day,is.setstate(ios_base::failbit) is called andymd is not modified[.](#15.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#15.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#15.sentence-4)
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6786)
|
||||
|
||||
*Returns*: is[.](#16.sentence-1)
|
||||
38
cppdraft/time/cal/ymd/overview.md
Normal file
38
cppdraft/time/cal/ymd/overview.md
Normal file
@@ -0,0 +1,38 @@
|
||||
[time.cal.ymd.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymd.overview)
|
||||
|
||||
### 30.8.14 Class year_month_day [[time.cal.ymd]](time.cal.ymd#overview)
|
||||
|
||||
#### 30.8.14.1 Overview [time.cal.ymd.overview]
|
||||
|
||||
namespace std::chrono {class year_month_day { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::day d_; // *exposition only*public: year_month_day() = default; constexpr year_month_day(const chrono::year& y, const chrono::month& m, const chrono::day& d) noexcept; constexpr year_month_day(const year_month_day_last& ymdl) noexcept; constexpr year_month_day(const sys_days& dp) noexcept; constexpr explicit year_month_day(const local_days& dp) noexcept; constexpr year_month_day& operator+=(const months& m) noexcept; constexpr year_month_day& operator-=(const months& m) noexcept; constexpr year_month_day& operator+=(const years& y) noexcept; constexpr year_month_day& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::day day() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6363)
|
||||
|
||||
year_month_day represents a specific year, month, and day[.](#1.sentence-1)
|
||||
|
||||
year_month_day is a field-based time point with a resolution of days[.](#1.sentence-2)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
year_month_day supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#1.sentence-5)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6375)
|
||||
|
||||
year_month_day is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
364
cppdraft/time/cal/ymdlast.md
Normal file
364
cppdraft/time/cal/ymdlast.md
Normal file
@@ -0,0 +1,364 @@
|
||||
[time.cal.ymdlast]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymdlast)
|
||||
|
||||
### 30.8.15 Class year_month_day_last [time.cal.ymdlast]
|
||||
|
||||
#### [30.8.15.1](#overview) Overview [[time.cal.ymdlast.overview]](time.cal.ymdlast.overview)
|
||||
|
||||
namespace std::chrono {class year_month_day_last { chrono::year y_; // *exposition only* chrono::month_day_last mdl_; // *exposition only*public:constexpr year_month_day_last(const chrono::year& y, const chrono::month_day_last& mdl) noexcept; constexpr year_month_day_last& operator+=(const months& m) noexcept; constexpr year_month_day_last& operator-=(const months& m) noexcept; constexpr year_month_day_last& operator+=(const years& y) noexcept; constexpr year_month_day_last& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::month_day_last month_day_last() const noexcept; constexpr chrono::day day() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6823)
|
||||
|
||||
year_month_day_last represents the last day of a specific year and month[.](#overview-1.sentence-1)
|
||||
|
||||
year_month_day_last is a field-based time point with a resolution of days,
|
||||
except that it is restricted to pointing to the last day of a year and month[.](#overview-1.sentence-2)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
year_month_day_last supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#overview-1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#overview-1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_day_last meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#overview-1.sentence-5)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6836)
|
||||
|
||||
year_month_day_last is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.15.2](#members) Member functions [[time.cal.ymdlast.members]](time.cal.ymdlast.members)
|
||||
|
||||
[ð](#lib:year_month_day_last,constructor)
|
||||
|
||||
`constexpr year_month_day_last(const chrono::year& y,
|
||||
const chrono::month_day_last& mdl) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6848)
|
||||
|
||||
*Effects*: Initializes y_ with y and mdl_ with mdl[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6859)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-2.sentence-1)
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6867)
|
||||
|
||||
*Effects*: *this = *this + m[.](#members-3.sentence-1)
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6871)
|
||||
|
||||
*Returns*: *this[.](#members-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6882)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-5.sentence-1)
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6890)
|
||||
|
||||
*Effects*: *this = *this - m[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6894)
|
||||
|
||||
*Returns*: *this[.](#members-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6905)
|
||||
|
||||
*Effects*: *this = *this + y[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6909)
|
||||
|
||||
*Returns*: *this[.](#members-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6920)
|
||||
|
||||
*Effects*: *this = *this - y[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6924)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_day_last)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6935)
|
||||
|
||||
*Returns*: y_[.](#members-12.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_day_last)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6946)
|
||||
|
||||
*Returns*: mdl_.month()[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:month_day_last,year_month_day_last)
|
||||
|
||||
`constexpr chrono::month_day_last month_day_last() const noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6957)
|
||||
|
||||
*Returns*: mdl_[.](#members-14.sentence-1)
|
||||
|
||||
[ð](#lib:day,year_month_day_last)
|
||||
|
||||
`constexpr chrono::day day() const noexcept;
|
||||
`
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6968)
|
||||
|
||||
*Returns*: If ok() is true,
|
||||
returns a day representing
|
||||
the last day of the (year, month) pair
|
||||
represented by *this[.](#members-15.sentence-1)
|
||||
|
||||
Otherwise, the returned value is unspecified[.](#members-15.sentence-2)
|
||||
|
||||
[16](#members-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6976)
|
||||
|
||||
[*Note [1](#members-note-1)*:
|
||||
|
||||
This value might be computed on demand[.](#members-16.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_day_last)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[17](#members-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6988)
|
||||
|
||||
*Returns*: sys_days{year()/month()/day()}[.](#members-17.sentence-1)
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_day_last)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[18](#members-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6999)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#members-18.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_day_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[19](#members-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7010)
|
||||
|
||||
*Returns*: y_.ok() && mdl_.ok()[.](#members-19.sentence-1)
|
||||
|
||||
#### [30.8.15.3](#nonmembers) Non-member functions [[time.cal.ymdlast.nonmembers]](time.cal.ymdlast.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,year_month_day_last)
|
||||
|
||||
`constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7023)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month_day_last() == y.month_day_last()[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year_month_day_last)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7035)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;return x.month_day_last() <=> y.month_day_last();
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const year_month_day_last& ymdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7051)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7059)
|
||||
|
||||
*Returns*: (ymdl.year() / ymdl.month() + dm) / last[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const months& dm, const year_month_day_last& ymdl) noexcept;
|
||||
`
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7071)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7079)
|
||||
|
||||
*Returns*: ymdl + dm[.](#nonmembers-6.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator-(const year_month_day_last& ymdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7091)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-7.sentence-1)
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7099)
|
||||
|
||||
*Returns*: ymdl + (-dm)[.](#nonmembers-8.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last__)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const year_month_day_last& ymdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7111)
|
||||
|
||||
*Returns*: {ymdl.year()+dy, ymdl.month_day_last()}[.](#nonmembers-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last___)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const years& dy, const year_month_day_last& ymdl) noexcept;
|
||||
`
|
||||
|
||||
[10](#nonmembers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7123)
|
||||
|
||||
*Returns*: ymdl + dy[.](#nonmembers-10.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator-(const year_month_day_last& ymdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[11](#nonmembers-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7135)
|
||||
|
||||
*Returns*: ymdl + (-dy)[.](#nonmembers-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_day_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_day_last& ymdl);
|
||||
`
|
||||
|
||||
[12](#nonmembers-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7148)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}"),
|
||||
ymdl.year(), ymdl.month_day_last());
|
||||
197
cppdraft/time/cal/ymdlast/members.md
Normal file
197
cppdraft/time/cal/ymdlast/members.md
Normal file
@@ -0,0 +1,197 @@
|
||||
[time.cal.ymdlast.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymdlast.members)
|
||||
|
||||
### 30.8.15 Class year_month_day_last [[time.cal.ymdlast]](time.cal.ymdlast#members)
|
||||
|
||||
#### 30.8.15.2 Member functions [time.cal.ymdlast.members]
|
||||
|
||||
[ð](#lib:year_month_day_last,constructor)
|
||||
|
||||
`constexpr year_month_day_last(const chrono::year& y,
|
||||
const chrono::month_day_last& mdl) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6848)
|
||||
|
||||
*Effects*: Initializes y_ with y and mdl_ with mdl[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6859)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6867)
|
||||
|
||||
*Effects*: *this = *this + m[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6871)
|
||||
|
||||
*Returns*: *this[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6882)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6890)
|
||||
|
||||
*Effects*: *this = *this - m[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6894)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6905)
|
||||
|
||||
*Effects*: *this = *this + y[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6909)
|
||||
|
||||
*Returns*: *this[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6920)
|
||||
|
||||
*Effects*: *this = *this - y[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6924)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_day_last)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6935)
|
||||
|
||||
*Returns*: y_[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_day_last)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6946)
|
||||
|
||||
*Returns*: mdl_.month()[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:month_day_last,year_month_day_last)
|
||||
|
||||
`constexpr chrono::month_day_last month_day_last() const noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6957)
|
||||
|
||||
*Returns*: mdl_[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:day,year_month_day_last)
|
||||
|
||||
`constexpr chrono::day day() const noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6968)
|
||||
|
||||
*Returns*: If ok() is true,
|
||||
returns a day representing
|
||||
the last day of the (year, month) pair
|
||||
represented by *this[.](#15.sentence-1)
|
||||
|
||||
Otherwise, the returned value is unspecified[.](#15.sentence-2)
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6976)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This value might be computed on demand[.](#16.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_day_last)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6988)
|
||||
|
||||
*Returns*: sys_days{year()/month()/day()}[.](#17.sentence-1)
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_day_last)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6999)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#18.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_day_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7010)
|
||||
|
||||
*Returns*: y_.ok() && mdl_.ok()[.](#19.sentence-1)
|
||||
142
cppdraft/time/cal/ymdlast/nonmembers.md
Normal file
142
cppdraft/time/cal/ymdlast/nonmembers.md
Normal file
@@ -0,0 +1,142 @@
|
||||
[time.cal.ymdlast.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymdlast.nonmembers)
|
||||
|
||||
### 30.8.15 Class year_month_day_last [[time.cal.ymdlast]](time.cal.ymdlast#nonmembers)
|
||||
|
||||
#### 30.8.15.3 Non-member functions [time.cal.ymdlast.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,year_month_day_last)
|
||||
|
||||
`constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7023)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month_day_last() == y.month_day_last()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,year_month_day_last)
|
||||
|
||||
`constexpr strong_ordering operator<=>(const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7035)
|
||||
|
||||
*Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;return x.month_day_last() <=> y.month_day_last();
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const year_month_day_last& ymdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7051)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7059)
|
||||
|
||||
*Returns*: (ymdl.year() / ymdl.month() + dm) / last[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const months& dm, const year_month_day_last& ymdl) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7071)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7079)
|
||||
|
||||
*Returns*: ymdl + dm[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day_last)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator-(const year_month_day_last& ymdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7091)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7099)
|
||||
|
||||
*Returns*: ymdl + (-dm)[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last__)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const year_month_day_last& ymdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7111)
|
||||
|
||||
*Returns*: {ymdl.year()+dy, ymdl.month_day_last()}[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_day_last___)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator+(const years& dy, const year_month_day_last& ymdl) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7123)
|
||||
|
||||
*Returns*: ymdl + dy[.](#10.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_day_last_)
|
||||
|
||||
`constexpr year_month_day_last
|
||||
operator-(const year_month_day_last& ymdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7135)
|
||||
|
||||
*Returns*: ymdl + (-dy)[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_day_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_day_last& ymdl);
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7148)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}"),
|
||||
ymdl.year(), ymdl.month_day_last());
|
||||
39
cppdraft/time/cal/ymdlast/overview.md
Normal file
39
cppdraft/time/cal/ymdlast/overview.md
Normal file
@@ -0,0 +1,39 @@
|
||||
[time.cal.ymdlast.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymdlast.overview)
|
||||
|
||||
### 30.8.15 Class year_month_day_last [[time.cal.ymdlast]](time.cal.ymdlast#overview)
|
||||
|
||||
#### 30.8.15.1 Overview [time.cal.ymdlast.overview]
|
||||
|
||||
namespace std::chrono {class year_month_day_last { chrono::year y_; // *exposition only* chrono::month_day_last mdl_; // *exposition only*public:constexpr year_month_day_last(const chrono::year& y, const chrono::month_day_last& mdl) noexcept; constexpr year_month_day_last& operator+=(const months& m) noexcept; constexpr year_month_day_last& operator-=(const months& m) noexcept; constexpr year_month_day_last& operator+=(const years& y) noexcept; constexpr year_month_day_last& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::month_day_last month_day_last() const noexcept; constexpr chrono::day day() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6823)
|
||||
|
||||
year_month_day_last represents the last day of a specific year and month[.](#1.sentence-1)
|
||||
|
||||
year_month_day_last is a field-based time point with a resolution of days,
|
||||
except that it is restricted to pointing to the last day of a year and month[.](#1.sentence-2)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
year_month_day_last supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_day_last meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements"))
|
||||
and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#1.sentence-5)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6836)
|
||||
|
||||
year_month_day_last is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
383
cppdraft/time/cal/ymwd.md
Normal file
383
cppdraft/time/cal/ymwd.md
Normal file
@@ -0,0 +1,383 @@
|
||||
[time.cal.ymwd]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwd)
|
||||
|
||||
### 30.8.16 Class year_month_weekday [time.cal.ymwd]
|
||||
|
||||
#### [30.8.16.1](#overview) Overview [[time.cal.ymwd.overview]](time.cal.ymwd.overview)
|
||||
|
||||
namespace std::chrono {class year_month_weekday { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::weekday_indexed wdi_; // *exposition only*public: year_month_weekday() = default; constexpr year_month_weekday(const chrono::year& y, const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; constexpr year_month_weekday(const sys_days& dp) noexcept; constexpr explicit year_month_weekday(const local_days& dp) noexcept; constexpr year_month_weekday& operator+=(const months& m) noexcept; constexpr year_month_weekday& operator-=(const months& m) noexcept; constexpr year_month_weekday& operator+=(const years& y) noexcept; constexpr year_month_weekday& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr unsigned index() const noexcept; constexpr chrono::weekday_indexed weekday_indexed() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7194)
|
||||
|
||||
year_month_weekday represents a specific year, month,
|
||||
and nth weekday of the month[.](#overview-1.sentence-1)
|
||||
|
||||
year_month_weekday is a field-based time point with a resolution of days[.](#overview-1.sentence-2)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
year_month_weekday supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#overview-1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#overview-1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_weekday meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#overview-1.sentence-5)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7206)
|
||||
|
||||
year_month_weekday is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.16.2](#members) Member functions [[time.cal.ymwd.members]](time.cal.ymwd.members)
|
||||
|
||||
[ð](#lib:year_month_weekday,constructor)
|
||||
|
||||
`constexpr year_month_weekday(const chrono::year& y, const chrono::month& m,
|
||||
const chrono::weekday_indexed& wdi) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7218)
|
||||
|
||||
*Effects*: Initializes y_ with y, m_ with m, and wdi_ with wdi[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_weekday,constructor_)
|
||||
|
||||
`constexpr year_month_weekday(const sys_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7229)
|
||||
|
||||
*Effects*: Constructs an object of type year_month_weekday which corresponds to the date represented by dp[.](#members-2.sentence-1)
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7234)
|
||||
|
||||
*Remarks*: For any value ymwd of type year_month_weekday for which ymwd.ok() is true,ymwd == year_month_weekday{sys_days{ymwd}} is true[.](#members-3.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_weekday,constructor__)
|
||||
|
||||
`constexpr explicit year_month_weekday(const local_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7247)
|
||||
|
||||
*Effects*: Equivalent to constructing with sys_days{dp.time_since_epoch()}[.](#members-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7258)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-5.sentence-1)
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7266)
|
||||
|
||||
*Effects*: *this = *this + m[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7270)
|
||||
|
||||
*Returns*: *this[.](#members-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7281)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7289)
|
||||
|
||||
*Effects*: *this = *this - m[.](#members-9.sentence-1)
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7293)
|
||||
|
||||
*Returns*: *this[.](#members-10.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7304)
|
||||
|
||||
*Effects*: *this = *this + y[.](#members-11.sentence-1)
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7308)
|
||||
|
||||
*Returns*: *this[.](#members-12.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7319)
|
||||
|
||||
*Effects*: *this = *this - y[.](#members-13.sentence-1)
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7323)
|
||||
|
||||
*Returns*: *this[.](#members-14.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_weekday)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7334)
|
||||
|
||||
*Returns*: y_[.](#members-15.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_weekday)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[16](#members-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7345)
|
||||
|
||||
*Returns*: m_[.](#members-16.sentence-1)
|
||||
|
||||
[ð](#lib:weekday,year_month_weekday)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[17](#members-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7356)
|
||||
|
||||
*Returns*: wdi_.weekday()[.](#members-17.sentence-1)
|
||||
|
||||
[ð](#lib:index,year_month_weekday)
|
||||
|
||||
`constexpr unsigned index() const noexcept;
|
||||
`
|
||||
|
||||
[18](#members-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7367)
|
||||
|
||||
*Returns*: wdi_.index()[.](#members-18.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_indexed,year_month_weekday)
|
||||
|
||||
`constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
|
||||
`
|
||||
|
||||
[19](#members-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7378)
|
||||
|
||||
*Returns*: wdi_[.](#members-19.sentence-1)
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_weekday)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[20](#members-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7389)
|
||||
|
||||
*Returns*: If y_.ok() && m_.ok() && wdi_.weekday().ok(),
|
||||
returns a sys_days that
|
||||
represents the date (index() - 1) * 7 days after
|
||||
the first weekday() of year()/month()[.](#members-20.sentence-1)
|
||||
|
||||
If index() is 0
|
||||
the returned sys_days represents the date 7 days prior to
|
||||
the first weekday() of year()/month()[.](#members-20.sentence-2)
|
||||
|
||||
Otherwise the returned value is unspecified[.](#members-20.sentence-3)
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_weekday)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[21](#members-21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7408)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#members-21.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_weekday)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[22](#members-22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7419)
|
||||
|
||||
*Returns*: If any ofy_.ok(),m_.ok(), orwdi_.ok() is false, returns false[.](#members-22.sentence-1)
|
||||
|
||||
Otherwise, if *this represents a valid date,
|
||||
returns true[.](#members-22.sentence-2)
|
||||
|
||||
Otherwise, returns false[.](#members-22.sentence-3)
|
||||
|
||||
#### [30.8.16.3](#nonmembers) Non-member functions [[time.cal.ymwd.nonmembers]](time.cal.ymwd.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,year_month_weekday)
|
||||
|
||||
`constexpr bool operator==(const year_month_weekday& x, const year_month_weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7439)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7452)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-2.sentence-1)
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7460)
|
||||
|
||||
*Returns*: (ymwd.year() / ymwd.month() + dm) / ymwd.weekday_indexed()[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday operator+(const months& dm, const year_month_weekday& ymwd) noexcept;
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7471)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7479)
|
||||
|
||||
*Returns*: ymwd + dm[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7490)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-6.sentence-1)
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7498)
|
||||
|
||||
*Returns*: ymwd + (-dm)[.](#nonmembers-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday__)
|
||||
|
||||
`constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7509)
|
||||
|
||||
*Returns*: {ymwd.year()+dy, ymwd.month(), ymwd.weekday_indexed()}[.](#nonmembers-8.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday___)
|
||||
|
||||
`constexpr year_month_weekday operator+(const years& dy, const year_month_weekday& ymwd) noexcept;
|
||||
`
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7520)
|
||||
|
||||
*Returns*: ymwd + dy[.](#nonmembers-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#nonmembers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7531)
|
||||
|
||||
*Returns*: ymwd + (-dy)[.](#nonmembers-10.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_weekday)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_weekday& ymwd);
|
||||
`
|
||||
|
||||
[11](#nonmembers-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7544)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}/{:L}"),
|
||||
ymwd.year(), ymwd.month(), ymwd.weekday_indexed());
|
||||
235
cppdraft/time/cal/ymwd/members.md
Normal file
235
cppdraft/time/cal/ymwd/members.md
Normal file
@@ -0,0 +1,235 @@
|
||||
[time.cal.ymwd.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwd.members)
|
||||
|
||||
### 30.8.16 Class year_month_weekday [[time.cal.ymwd]](time.cal.ymwd#members)
|
||||
|
||||
#### 30.8.16.2 Member functions [time.cal.ymwd.members]
|
||||
|
||||
[ð](#lib:year_month_weekday,constructor)
|
||||
|
||||
`constexpr year_month_weekday(const chrono::year& y, const chrono::month& m,
|
||||
const chrono::weekday_indexed& wdi) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7218)
|
||||
|
||||
*Effects*: Initializes y_ with y, m_ with m, and wdi_ with wdi[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_weekday,constructor_)
|
||||
|
||||
`constexpr year_month_weekday(const sys_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7229)
|
||||
|
||||
*Effects*: Constructs an object of type year_month_weekday which corresponds to the date represented by dp[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7234)
|
||||
|
||||
*Remarks*: For any value ymwd of type year_month_weekday for which ymwd.ok() is true,ymwd == year_month_weekday{sys_days{ymwd}} is true[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:year_month_weekday,constructor__)
|
||||
|
||||
`constexpr explicit year_month_weekday(const local_days& dp) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7247)
|
||||
|
||||
*Effects*: Equivalent to constructing with sys_days{dp.time_since_epoch()}[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7258)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7266)
|
||||
|
||||
*Effects*: *this = *this + m[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7270)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7281)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7289)
|
||||
|
||||
*Effects*: *this = *this - m[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7293)
|
||||
|
||||
*Returns*: *this[.](#10.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7304)
|
||||
|
||||
*Effects*: *this = *this + y[.](#11.sentence-1)
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7308)
|
||||
|
||||
*Returns*: *this[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7319)
|
||||
|
||||
*Effects*: *this = *this - y[.](#13.sentence-1)
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7323)
|
||||
|
||||
*Returns*: *this[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_weekday)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7334)
|
||||
|
||||
*Returns*: y_[.](#15.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_weekday)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7345)
|
||||
|
||||
*Returns*: m_[.](#16.sentence-1)
|
||||
|
||||
[ð](#lib:weekday,year_month_weekday)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7356)
|
||||
|
||||
*Returns*: wdi_.weekday()[.](#17.sentence-1)
|
||||
|
||||
[ð](#lib:index,year_month_weekday)
|
||||
|
||||
`constexpr unsigned index() const noexcept;
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7367)
|
||||
|
||||
*Returns*: wdi_.index()[.](#18.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_indexed,year_month_weekday)
|
||||
|
||||
`constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7378)
|
||||
|
||||
*Returns*: wdi_[.](#19.sentence-1)
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_weekday)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7389)
|
||||
|
||||
*Returns*: If y_.ok() && m_.ok() && wdi_.weekday().ok(),
|
||||
returns a sys_days that
|
||||
represents the date (index() - 1) * 7 days after
|
||||
the first weekday() of year()/month()[.](#20.sentence-1)
|
||||
|
||||
If index() is 0
|
||||
the returned sys_days represents the date 7 days prior to
|
||||
the first weekday() of year()/month()[.](#20.sentence-2)
|
||||
|
||||
Otherwise the returned value is unspecified[.](#20.sentence-3)
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_weekday)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[21](#21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7408)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#21.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_weekday)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[22](#22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7419)
|
||||
|
||||
*Returns*: If any ofy_.ok(),m_.ok(), orwdi_.ok() is false, returns false[.](#22.sentence-1)
|
||||
|
||||
Otherwise, if *this represents a valid date,
|
||||
returns true[.](#22.sentence-2)
|
||||
|
||||
Otherwise, returns false[.](#22.sentence-3)
|
||||
124
cppdraft/time/cal/ymwd/nonmembers.md
Normal file
124
cppdraft/time/cal/ymwd/nonmembers.md
Normal file
@@ -0,0 +1,124 @@
|
||||
[time.cal.ymwd.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwd.nonmembers)
|
||||
|
||||
### 30.8.16 Class year_month_weekday [[time.cal.ymwd]](time.cal.ymwd#nonmembers)
|
||||
|
||||
#### 30.8.16.3 Non-member functions [time.cal.ymwd.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,year_month_weekday)
|
||||
|
||||
`constexpr bool operator==(const year_month_weekday& x, const year_month_weekday& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7439)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7452)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7460)
|
||||
|
||||
*Returns*: (ymwd.year() / ymwd.month() + dm) / ymwd.weekday_indexed()[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday operator+(const months& dm, const year_month_weekday& ymwd) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7471)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7479)
|
||||
|
||||
*Returns*: ymwd + dm[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday)
|
||||
|
||||
`constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7490)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7498)
|
||||
|
||||
*Returns*: ymwd + (-dm)[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday__)
|
||||
|
||||
`constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7509)
|
||||
|
||||
*Returns*: {ymwd.year()+dy, ymwd.month(), ymwd.weekday_indexed()}[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday___)
|
||||
|
||||
`constexpr year_month_weekday operator+(const years& dy, const year_month_weekday& ymwd) noexcept;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7520)
|
||||
|
||||
*Returns*: ymwd + dy[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday_)
|
||||
|
||||
`constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7531)
|
||||
|
||||
*Returns*: ymwd + (-dy)[.](#10.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_weekday)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_weekday& ymwd);
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7544)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}/{:L}"),
|
||||
ymwd.year(), ymwd.month(), ymwd.weekday_indexed());
|
||||
38
cppdraft/time/cal/ymwd/overview.md
Normal file
38
cppdraft/time/cal/ymwd/overview.md
Normal file
@@ -0,0 +1,38 @@
|
||||
[time.cal.ymwd.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwd.overview)
|
||||
|
||||
### 30.8.16 Class year_month_weekday [[time.cal.ymwd]](time.cal.ymwd#overview)
|
||||
|
||||
#### 30.8.16.1 Overview [time.cal.ymwd.overview]
|
||||
|
||||
namespace std::chrono {class year_month_weekday { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::weekday_indexed wdi_; // *exposition only*public: year_month_weekday() = default; constexpr year_month_weekday(const chrono::year& y, const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; constexpr year_month_weekday(const sys_days& dp) noexcept; constexpr explicit year_month_weekday(const local_days& dp) noexcept; constexpr year_month_weekday& operator+=(const months& m) noexcept; constexpr year_month_weekday& operator-=(const months& m) noexcept; constexpr year_month_weekday& operator+=(const years& y) noexcept; constexpr year_month_weekday& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr unsigned index() const noexcept; constexpr chrono::weekday_indexed weekday_indexed() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7194)
|
||||
|
||||
year_month_weekday represents a specific year, month,
|
||||
and nth weekday of the month[.](#1.sentence-1)
|
||||
|
||||
year_month_weekday is a field-based time point with a resolution of days[.](#1.sentence-2)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
year_month_weekday supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_weekday meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#1.sentence-5)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7206)
|
||||
|
||||
year_month_weekday is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
342
cppdraft/time/cal/ymwdlast.md
Normal file
342
cppdraft/time/cal/ymwdlast.md
Normal file
@@ -0,0 +1,342 @@
|
||||
[time.cal.ymwdlast]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwdlast)
|
||||
|
||||
### 30.8.17 Class year_month_weekday_last [time.cal.ymwdlast]
|
||||
|
||||
#### [30.8.17.1](#overview) Overview [[time.cal.ymwdlast.overview]](time.cal.ymwdlast.overview)
|
||||
|
||||
namespace std::chrono {class year_month_weekday_last { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::weekday_last wdl_; // *exposition only*public:constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m, const chrono::weekday_last& wdl) noexcept; constexpr year_month_weekday_last& operator+=(const months& m) noexcept; constexpr year_month_weekday_last& operator-=(const months& m) noexcept; constexpr year_month_weekday_last& operator+=(const years& y) noexcept; constexpr year_month_weekday_last& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr chrono::weekday_last weekday_last() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7586)
|
||||
|
||||
year_month_weekday_last represents a specific year, month,
|
||||
and last weekday of the month[.](#overview-1.sentence-1)
|
||||
|
||||
year_month_weekday_last is a field-based time point with a resolution of days,
|
||||
except that it is restricted to pointing to the last weekday of a year and month[.](#overview-1.sentence-2)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
year_month_weekday_last supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#overview-1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#overview-1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_weekday_last meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#overview-1.sentence-5)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7599)
|
||||
|
||||
year_month_weekday_last is a trivially copyable and standard-layout class type[.](#overview-2.sentence-1)
|
||||
|
||||
#### [30.8.17.2](#members) Member functions [[time.cal.ymwdlast.members]](time.cal.ymwdlast.members)
|
||||
|
||||
[ð](#lib:year_month_weekday_last,constructor)
|
||||
|
||||
`constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m,
|
||||
const chrono::weekday_last& wdl) noexcept;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7611)
|
||||
|
||||
*Effects*: Initializes y_ with y, m_ with m, and wdl_ with wdl[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7622)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-2.sentence-1)
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7630)
|
||||
|
||||
*Effects*: *this = *this + m[.](#members-3.sentence-1)
|
||||
|
||||
[4](#members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7634)
|
||||
|
||||
*Returns*: *this[.](#members-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[5](#members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7645)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#members-5.sentence-1)
|
||||
|
||||
[6](#members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7653)
|
||||
|
||||
*Effects*: *this = *this - m[.](#members-6.sentence-1)
|
||||
|
||||
[7](#members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7657)
|
||||
|
||||
*Returns*: *this[.](#members-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[8](#members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7668)
|
||||
|
||||
*Effects*: *this = *this + y[.](#members-8.sentence-1)
|
||||
|
||||
[9](#members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7672)
|
||||
|
||||
*Returns*: *this[.](#members-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7683)
|
||||
|
||||
*Effects*: *this = *this - y[.](#members-10.sentence-1)
|
||||
|
||||
[11](#members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7687)
|
||||
|
||||
*Returns*: *this[.](#members-11.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[12](#members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7698)
|
||||
|
||||
*Returns*: y_[.](#members-12.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[13](#members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7709)
|
||||
|
||||
*Returns*: m_[.](#members-13.sentence-1)
|
||||
|
||||
[ð](#lib:weekday,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[14](#members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7720)
|
||||
|
||||
*Returns*: wdl_.weekday()[.](#members-14.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_last,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::weekday_last weekday_last() const noexcept;
|
||||
`
|
||||
|
||||
[15](#members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7731)
|
||||
|
||||
*Returns*: wdl_[.](#members-15.sentence-1)
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_weekday_last)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[16](#members-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7742)
|
||||
|
||||
*Returns*: If ok() == true,
|
||||
returns a sys_days that represents
|
||||
the last weekday() of year()/month()[.](#members-16.sentence-1)
|
||||
|
||||
Otherwise the returned value is unspecified[.](#members-16.sentence-2)
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_weekday_last)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[17](#members-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7756)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#members-17.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_weekday_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[18](#members-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7767)
|
||||
|
||||
*Returns*: y_.ok() && m_.ok() && wdl_.ok()[.](#members-18.sentence-1)
|
||||
|
||||
#### [30.8.17.3](#nonmembers) Non-member functions [[time.cal.ymwdlast.nonmembers]](time.cal.ymwdlast.nonmembers)
|
||||
|
||||
[ð](#lib:operator==,year_month_weekday_last)
|
||||
|
||||
`constexpr bool operator==(const year_month_weekday_last& x,
|
||||
const year_month_weekday_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7781)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month() && x.weekday_last() == y.weekday_last()
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7795)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-2.sentence-1)
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7803)
|
||||
|
||||
*Returns*: (ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()[.](#nonmembers-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept;
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7815)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7823)
|
||||
|
||||
*Returns*: ymwdl + dm[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7835)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#nonmembers-6.sentence-1)
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7843)
|
||||
|
||||
*Returns*: ymwdl + (-dm)[.](#nonmembers-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last__)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[8](#nonmembers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7855)
|
||||
|
||||
*Returns*: {ymwdl.year()+dy, ymwdl.month(), ymwdl.weekday_last()}[.](#nonmembers-8.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last___)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept;
|
||||
`
|
||||
|
||||
[9](#nonmembers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7867)
|
||||
|
||||
*Returns*: ymwdl + dy[.](#nonmembers-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#nonmembers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7879)
|
||||
|
||||
*Returns*: ymwdl + (-dy)[.](#nonmembers-10.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_weekday_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_weekday_last& ymwdl);
|
||||
`
|
||||
|
||||
[11](#nonmembers-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7892)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}/{:L}"),
|
||||
ymwdl.year(), ymwdl.month(), ymwdl.weekday_last());
|
||||
186
cppdraft/time/cal/ymwdlast/members.md
Normal file
186
cppdraft/time/cal/ymwdlast/members.md
Normal file
@@ -0,0 +1,186 @@
|
||||
[time.cal.ymwdlast.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwdlast.members)
|
||||
|
||||
### 30.8.17 Class year_month_weekday_last [[time.cal.ymwdlast]](time.cal.ymwdlast#members)
|
||||
|
||||
#### 30.8.17.2 Member functions [time.cal.ymwdlast.members]
|
||||
|
||||
[ð](#lib:year_month_weekday_last,constructor)
|
||||
|
||||
`constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m,
|
||||
const chrono::weekday_last& wdl) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7611)
|
||||
|
||||
*Effects*: Initializes y_ with y, m_ with m, and wdl_ with wdl[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last& operator+=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7622)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7630)
|
||||
|
||||
*Effects*: *this = *this + m[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7634)
|
||||
|
||||
*Returns*: *this[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last& operator-=(const months& m) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7645)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7653)
|
||||
|
||||
*Effects*: *this = *this - m[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7657)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last& operator+=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7668)
|
||||
|
||||
*Effects*: *this = *this + y[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7672)
|
||||
|
||||
*Returns*: *this[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last& operator-=(const years& y) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7683)
|
||||
|
||||
*Effects*: *this = *this - y[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7687)
|
||||
|
||||
*Returns*: *this[.](#11.sentence-1)
|
||||
|
||||
[ð](#lib:year,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::year year() const noexcept;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7698)
|
||||
|
||||
*Returns*: y_[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:month,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::month month() const noexcept;
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7709)
|
||||
|
||||
*Returns*: m_[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:weekday,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::weekday weekday() const noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7720)
|
||||
|
||||
*Returns*: wdl_.weekday()[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:weekday_last,year_month_weekday_last)
|
||||
|
||||
`constexpr chrono::weekday_last weekday_last() const noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7731)
|
||||
|
||||
*Returns*: wdl_[.](#15.sentence-1)
|
||||
|
||||
[ð](#lib:operator_sys_days,year_month_weekday_last)
|
||||
|
||||
`constexpr operator sys_days() const noexcept;
|
||||
`
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7742)
|
||||
|
||||
*Returns*: If ok() == true,
|
||||
returns a sys_days that represents
|
||||
the last weekday() of year()/month()[.](#16.sentence-1)
|
||||
|
||||
Otherwise the returned value is unspecified[.](#16.sentence-2)
|
||||
|
||||
[ð](#lib:operator_local_days,year_month_weekday_last)
|
||||
|
||||
`constexpr explicit operator local_days() const noexcept;
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7756)
|
||||
|
||||
*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#17.sentence-1)
|
||||
|
||||
[ð](#lib:ok,year_month_weekday_last)
|
||||
|
||||
`constexpr bool ok() const noexcept;
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7767)
|
||||
|
||||
*Returns*: y_.ok() && m_.ok() && wdl_.ok()[.](#18.sentence-1)
|
||||
131
cppdraft/time/cal/ymwdlast/nonmembers.md
Normal file
131
cppdraft/time/cal/ymwdlast/nonmembers.md
Normal file
@@ -0,0 +1,131 @@
|
||||
[time.cal.ymwdlast.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwdlast.nonmembers)
|
||||
|
||||
### 30.8.17 Class year_month_weekday_last [[time.cal.ymwdlast]](time.cal.ymwdlast#nonmembers)
|
||||
|
||||
#### 30.8.17.3 Non-member functions [time.cal.ymwdlast.nonmembers]
|
||||
|
||||
[ð](#lib:operator==,year_month_weekday_last)
|
||||
|
||||
`constexpr bool operator==(const year_month_weekday_last& x,
|
||||
const year_month_weekday_last& y) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7781)
|
||||
|
||||
*Returns*: x.year() == y.year() && x.month() == y.month() && x.weekday_last() == y.weekday_last()
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7795)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7803)
|
||||
|
||||
*Returns*: (ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7815)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7823)
|
||||
|
||||
*Returns*: ymwdl + dm[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday_last)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7835)
|
||||
|
||||
*Constraints*: If the argument supplied by the caller for the months parameter
|
||||
is convertible to years,
|
||||
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7843)
|
||||
|
||||
*Returns*: ymwdl + (-dm)[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last__)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7855)
|
||||
|
||||
*Returns*: {ymwdl.year()+dy, ymwdl.month(), ymwdl.weekday_last()}[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,year_month_weekday_last___)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7867)
|
||||
|
||||
*Returns*: ymwdl + dy[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,year_month_weekday_last_)
|
||||
|
||||
`constexpr year_month_weekday_last
|
||||
operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7879)
|
||||
|
||||
*Returns*: ymwdl + (-dy)[.](#10.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c%3c,year_month_weekday_last)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const year_month_weekday_last& ymwdl);
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7892)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{}/{:L}/{:L}"),
|
||||
ymwdl.year(), ymwdl.month(), ymwdl.weekday_last());
|
||||
39
cppdraft/time/cal/ymwdlast/overview.md
Normal file
39
cppdraft/time/cal/ymwdlast/overview.md
Normal file
@@ -0,0 +1,39 @@
|
||||
[time.cal.ymwdlast.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.8 The civil calendar [[time.cal]](time.cal#ymwdlast.overview)
|
||||
|
||||
### 30.8.17 Class year_month_weekday_last [[time.cal.ymwdlast]](time.cal.ymwdlast#overview)
|
||||
|
||||
#### 30.8.17.1 Overview [time.cal.ymwdlast.overview]
|
||||
|
||||
namespace std::chrono {class year_month_weekday_last { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::weekday_last wdl_; // *exposition only*public:constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m, const chrono::weekday_last& wdl) noexcept; constexpr year_month_weekday_last& operator+=(const months& m) noexcept; constexpr year_month_weekday_last& operator-=(const months& m) noexcept; constexpr year_month_weekday_last& operator+=(const years& y) noexcept; constexpr year_month_weekday_last& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr chrono::weekday_last weekday_last() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7586)
|
||||
|
||||
year_month_weekday_last represents a specific year, month,
|
||||
and last weekday of the month[.](#1.sentence-1)
|
||||
|
||||
year_month_weekday_last is a field-based time point with a resolution of days,
|
||||
except that it is restricted to pointing to the last weekday of a year and month[.](#1.sentence-2)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
year_month_weekday_last supports years- and months-oriented arithmetic,
|
||||
but not days-oriented arithmetic[.](#1.sentence-3)
|
||||
|
||||
For the latter, there is a conversion to sys_days,
|
||||
which efficiently supports days-oriented arithmetic[.](#1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
year_month_weekday_last meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#1.sentence-5)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7599)
|
||||
|
||||
year_month_weekday_last is a trivially copyable and standard-layout class type[.](#2.sentence-1)
|
||||
1126
cppdraft/time/clock.md
Normal file
1126
cppdraft/time/clock.md
Normal file
File diff suppressed because it is too large
Load Diff
274
cppdraft/time/clock/cast.md
Normal file
274
cppdraft/time/clock/cast.md
Normal file
@@ -0,0 +1,274 @@
|
||||
[time.clock.cast]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#cast)
|
||||
|
||||
### 30.7.10 time_point conversions [time.clock.cast]
|
||||
|
||||
#### [30.7.10.1](#time.clock.conv) Class template clock_time_conversion [[time.clock.conv]](time.clock.conv)
|
||||
|
||||
namespace std::chrono {template<class DestClock, class SourceClock>struct clock_time_conversion {};}
|
||||
|
||||
[1](#time.clock.conv-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3583)
|
||||
|
||||
clock_time_conversion serves as a trait
|
||||
which can be used to specify how to convert
|
||||
a source time_point of typetime_point<SourceClock, Duration> to a destination time_point of typetime_point<DestClock, Duration> via a specialization:clock_time_conversion<DestClock, SourceClock>[.](#time.clock.conv-1.sentence-1)
|
||||
|
||||
A specialization of clock_time_conversion<DestClock, SourceClock> shall provide a const-qualified operator() that takes a parameter of type time_point<SourceClock, Duration> and returns a time_point<DestClock, OtherDuration> representing an equivalent point in time[.](#time.clock.conv-1.sentence-2)
|
||||
|
||||
OtherDuration is a chrono::duration whose specialization is computed from the input Duration in a manner which can vary for each clock_time_conversion specialization[.](#time.clock.conv-1.sentence-3)
|
||||
|
||||
A program may specialize clock_time_conversion if at least one of the template parameters is a user-defined clock type[.](#time.clock.conv-1.sentence-4)
|
||||
|
||||
[2](#time.clock.conv-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3603)
|
||||
|
||||
Several specializations are provided by the implementation,
|
||||
as described in[[time.clock.cast.id]](#id "30.7.10.2 Identity conversions"),[[time.clock.cast.sys.utc]](#sys.utc "30.7.10.3 Conversions between system_clock and utc_clock"),[[time.clock.cast.sys]](#sys "30.7.10.4 Conversions between system_clock and other clocks"), and[[time.clock.cast.utc]](#utc "30.7.10.5 Conversions between utc_clock and other clocks")[.](#time.clock.conv-2.sentence-1)
|
||||
|
||||
#### [30.7.10.2](#id) Identity conversions [[time.clock.cast.id]](time.clock.cast.id)
|
||||
|
||||
template<class Clock>struct clock_time_conversion<Clock, Clock> {template<class Duration> time_point<Clock, Duration>operator()(const time_point<Clock, Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion)
|
||||
|
||||
`template<class Duration>
|
||||
time_point<Clock, Duration>
|
||||
operator()(const time_point<Clock, Duration>& t) const;
|
||||
`
|
||||
|
||||
[1](#id-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3630)
|
||||
|
||||
*Returns*: t[.](#id-1.sentence-1)
|
||||
|
||||
template<>struct clock_time_conversion<system_clock, system_clock> {template<class Duration> sys_time<Duration>operator()(const sys_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion_)
|
||||
|
||||
`template<class Duration>
|
||||
sys_time<Duration>
|
||||
operator()(const sys_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[2](#id-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3652)
|
||||
|
||||
*Returns*: t[.](#id-2.sentence-1)
|
||||
|
||||
template<>struct clock_time_conversion<utc_clock, utc_clock> {template<class Duration> utc_time<Duration>operator()(const utc_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion__)
|
||||
|
||||
`template<class Duration>
|
||||
utc_time<Duration>
|
||||
operator()(const utc_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[3](#id-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3674)
|
||||
|
||||
*Returns*: t[.](#id-3.sentence-1)
|
||||
|
||||
#### [30.7.10.3](#sys.utc) Conversions between system_clock and utc_clock [[time.clock.cast.sys.utc]](time.clock.cast.sys.utc)
|
||||
|
||||
template<>struct clock_time_conversion<utc_clock, system_clock> {template<class Duration> utc_time<common_type_t<Duration, seconds>>operator()(const sys_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion___)
|
||||
|
||||
`template<class Duration>
|
||||
utc_time<common_type_t<Duration, seconds>>
|
||||
operator()(const sys_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[1](#sys.utc-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3698)
|
||||
|
||||
*Returns*: utc_clock::from_sys(t)[.](#sys.utc-1.sentence-1)
|
||||
|
||||
template<>struct clock_time_conversion<system_clock, utc_clock> {template<class Duration> sys_time<common_type_t<Duration, seconds>>operator()(const utc_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion____)
|
||||
|
||||
`template<class Duration>
|
||||
sys_time<common_type_t<Duration, seconds>>
|
||||
operator()(const utc_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[2](#sys.utc-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3720)
|
||||
|
||||
*Returns*: utc_clock::to_sys(t)[.](#sys.utc-2.sentence-1)
|
||||
|
||||
#### [30.7.10.4](#sys) Conversions between system_clock and other clocks [[time.clock.cast.sys]](time.clock.cast.sys)
|
||||
|
||||
template<class SourceClock>struct clock_time_conversion<system_clock, SourceClock> {template<class Duration>auto operator()(const time_point<SourceClock, Duration>& t) const-> decltype(SourceClock::to_sys(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion_____)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const time_point<SourceClock, Duration>& t) const
|
||||
-> decltype(SourceClock::to_sys(t));
|
||||
`
|
||||
|
||||
[1](#sys-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3744)
|
||||
|
||||
*Constraints*: SourceClock::to_sys(t) is well-formed[.](#sys-1.sentence-1)
|
||||
|
||||
[2](#sys-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3748)
|
||||
|
||||
*Mandates*: SourceClock::to_sys(t) returns a sys_time<Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#sys-2.sentence-1)
|
||||
|
||||
[3](#sys-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3753)
|
||||
|
||||
*Returns*: SourceClock::to_sys(t)[.](#sys-3.sentence-1)
|
||||
|
||||
template<class DestClock>struct clock_time_conversion<DestClock, system_clock> {template<class Duration>auto operator()(const sys_time<Duration>& t) const-> decltype(DestClock::from_sys(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion______)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const sys_time<Duration>& t) const
|
||||
-> decltype(DestClock::from_sys(t));
|
||||
`
|
||||
|
||||
[4](#sys-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3775)
|
||||
|
||||
*Constraints*: DestClock::from_sys(t) is well-formed[.](#sys-4.sentence-1)
|
||||
|
||||
[5](#sys-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3779)
|
||||
|
||||
*Mandates*: DestClock::from_sys(t) returns a time_point<DestClock, Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#sys-5.sentence-1)
|
||||
|
||||
[6](#sys-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3784)
|
||||
|
||||
*Returns*: DestClock::from_sys(t)[.](#sys-6.sentence-1)
|
||||
|
||||
#### [30.7.10.5](#utc) Conversions between utc_clock and other clocks [[time.clock.cast.utc]](time.clock.cast.utc)
|
||||
|
||||
template<class SourceClock>struct clock_time_conversion<utc_clock, SourceClock> {template<class Duration>auto operator()(const time_point<SourceClock, Duration>& t) const-> decltype(SourceClock::to_utc(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion_______)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const time_point<SourceClock, Duration>& t) const
|
||||
-> decltype(SourceClock::to_utc(t));
|
||||
`
|
||||
|
||||
[1](#utc-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3808)
|
||||
|
||||
*Constraints*: SourceClock::to_utc(t) is well-formed[.](#utc-1.sentence-1)
|
||||
|
||||
[2](#utc-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3812)
|
||||
|
||||
*Mandates*: SourceClock::to_utc(t) returns a utc_time<Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#utc-2.sentence-1)
|
||||
|
||||
[3](#utc-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3817)
|
||||
|
||||
*Returns*: SourceClock::to_utc(t)[.](#utc-3.sentence-1)
|
||||
|
||||
template<class DestClock>struct clock_time_conversion<DestClock, utc_clock> {template<class Duration>auto operator()(const utc_time<Duration>& t) const-> decltype(DestClock::from_utc(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion________)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const utc_time<Duration>& t) const
|
||||
-> decltype(DestClock::from_utc(t));
|
||||
`
|
||||
|
||||
[4](#utc-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3839)
|
||||
|
||||
*Constraints*: DestClock::from_utc(t) is well-formed[.](#utc-4.sentence-1)
|
||||
|
||||
[5](#utc-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3843)
|
||||
|
||||
*Mandates*: DestClock::from_utc(t) returns a time_point<DestClock, Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#utc-5.sentence-1)
|
||||
|
||||
[6](#utc-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3848)
|
||||
|
||||
*Returns*: DestClock::from_utc(t)[.](#utc-6.sentence-1)
|
||||
|
||||
#### [30.7.10.6](#fn) Function template clock_cast [[time.clock.cast.fn]](time.clock.cast.fn)
|
||||
|
||||
[ð](#lib:clock_cast)
|
||||
|
||||
`template<class DestClock, class SourceClock, class Duration>
|
||||
auto clock_cast(const time_point<SourceClock, Duration>& t);
|
||||
`
|
||||
|
||||
[1](#fn-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3862)
|
||||
|
||||
*Constraints*: At least one of the following clock time conversion expressions
|
||||
is well-formed:
|
||||
|
||||
- [(1.1)](#fn-1.1)
|
||||
|
||||
clock_time_conversion<DestClock, SourceClock>{}(t)
|
||||
|
||||
- [(1.2)](#fn-1.2)
|
||||
|
||||
clock_time_conversion<DestClock, system_clock>{}( clock_time_conversion<system_clock, SourceClock>{}(t))
|
||||
|
||||
- [(1.3)](#fn-1.3)
|
||||
|
||||
clock_time_conversion<DestClock, utc_clock>{}( clock_time_conversion<utc_clock, SourceClock>{}(t))
|
||||
|
||||
- [(1.4)](#fn-1.4)
|
||||
|
||||
clock_time_conversion<DestClock, utc_clock>{}( clock_time_conversion<utc_clock, system_clock>{}( clock_time_conversion<system_clock, SourceClock>{}(t)))
|
||||
|
||||
- [(1.5)](#fn-1.5)
|
||||
|
||||
clock_time_conversion<DestClock, system_clock>{}( clock_time_conversion<system_clock, utc_clock>{}( clock_time_conversion<utc_clock, SourceClock>{}(t)))
|
||||
|
||||
A clock time conversion expression is considered better than
|
||||
another clock time conversion expression if it involves feweroperator() calls on clock_time_conversion specializations[.](#fn-1.sentence-2)
|
||||
|
||||
[2](#fn-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3904)
|
||||
|
||||
*Mandates*: Among the well-formed clock time conversion expressions
|
||||
from the above list, there is a unique best expression[.](#fn-2.sentence-1)
|
||||
|
||||
[3](#fn-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3909)
|
||||
|
||||
*Returns*: The best well-formed clock time conversion expression in the above list[.](#fn-3.sentence-1)
|
||||
58
cppdraft/time/clock/cast/fn.md
Normal file
58
cppdraft/time/clock/cast/fn.md
Normal file
@@ -0,0 +1,58 @@
|
||||
[time.clock.cast.fn]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#cast.fn)
|
||||
|
||||
### 30.7.10 time_point conversions [[time.clock.cast]](time.clock.cast#fn)
|
||||
|
||||
#### 30.7.10.6 Function template clock_cast [time.clock.cast.fn]
|
||||
|
||||
[ð](#lib:clock_cast)
|
||||
|
||||
`template<class DestClock, class SourceClock, class Duration>
|
||||
auto clock_cast(const time_point<SourceClock, Duration>& t);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3862)
|
||||
|
||||
*Constraints*: At least one of the following clock time conversion expressions
|
||||
is well-formed:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
clock_time_conversion<DestClock, SourceClock>{}(t)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
clock_time_conversion<DestClock, system_clock>{}( clock_time_conversion<system_clock, SourceClock>{}(t))
|
||||
|
||||
- [(1.3)](#1.3)
|
||||
|
||||
clock_time_conversion<DestClock, utc_clock>{}( clock_time_conversion<utc_clock, SourceClock>{}(t))
|
||||
|
||||
- [(1.4)](#1.4)
|
||||
|
||||
clock_time_conversion<DestClock, utc_clock>{}( clock_time_conversion<utc_clock, system_clock>{}( clock_time_conversion<system_clock, SourceClock>{}(t)))
|
||||
|
||||
- [(1.5)](#1.5)
|
||||
|
||||
clock_time_conversion<DestClock, system_clock>{}( clock_time_conversion<system_clock, utc_clock>{}( clock_time_conversion<utc_clock, SourceClock>{}(t)))
|
||||
|
||||
A clock time conversion expression is considered better than
|
||||
another clock time conversion expression if it involves feweroperator() calls on clock_time_conversion specializations[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3904)
|
||||
|
||||
*Mandates*: Among the well-formed clock time conversion expressions
|
||||
from the above list, there is a unique best expression[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3909)
|
||||
|
||||
*Returns*: The best well-formed clock time conversion expression in the above list[.](#3.sentence-1)
|
||||
54
cppdraft/time/clock/cast/id.md
Normal file
54
cppdraft/time/clock/cast/id.md
Normal file
@@ -0,0 +1,54 @@
|
||||
[time.clock.cast.id]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#cast.id)
|
||||
|
||||
### 30.7.10 time_point conversions [[time.clock.cast]](time.clock.cast#id)
|
||||
|
||||
#### 30.7.10.2 Identity conversions [time.clock.cast.id]
|
||||
|
||||
template<class Clock>struct clock_time_conversion<Clock, Clock> {template<class Duration> time_point<Clock, Duration>operator()(const time_point<Clock, Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion)
|
||||
|
||||
`template<class Duration>
|
||||
time_point<Clock, Duration>
|
||||
operator()(const time_point<Clock, Duration>& t) const;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3630)
|
||||
|
||||
*Returns*: t[.](#1.sentence-1)
|
||||
|
||||
template<>struct clock_time_conversion<system_clock, system_clock> {template<class Duration> sys_time<Duration>operator()(const sys_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion_)
|
||||
|
||||
`template<class Duration>
|
||||
sys_time<Duration>
|
||||
operator()(const sys_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3652)
|
||||
|
||||
*Returns*: t[.](#2.sentence-1)
|
||||
|
||||
template<>struct clock_time_conversion<utc_clock, utc_clock> {template<class Duration> utc_time<Duration>operator()(const utc_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion__)
|
||||
|
||||
`template<class Duration>
|
||||
utc_time<Duration>
|
||||
operator()(const utc_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3674)
|
||||
|
||||
*Returns*: t[.](#3.sentence-1)
|
||||
63
cppdraft/time/clock/cast/sys.md
Normal file
63
cppdraft/time/clock/cast/sys.md
Normal file
@@ -0,0 +1,63 @@
|
||||
[time.clock.cast.sys]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#cast.sys)
|
||||
|
||||
### 30.7.10 time_point conversions [[time.clock.cast]](time.clock.cast#sys)
|
||||
|
||||
#### 30.7.10.4 Conversions between system_clock and other clocks [time.clock.cast.sys]
|
||||
|
||||
template<class SourceClock>struct clock_time_conversion<system_clock, SourceClock> {template<class Duration>auto operator()(const time_point<SourceClock, Duration>& t) const-> decltype(SourceClock::to_sys(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const time_point<SourceClock, Duration>& t) const
|
||||
-> decltype(SourceClock::to_sys(t));
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3744)
|
||||
|
||||
*Constraints*: SourceClock::to_sys(t) is well-formed[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3748)
|
||||
|
||||
*Mandates*: SourceClock::to_sys(t) returns a sys_time<Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3753)
|
||||
|
||||
*Returns*: SourceClock::to_sys(t)[.](#3.sentence-1)
|
||||
|
||||
template<class DestClock>struct clock_time_conversion<DestClock, system_clock> {template<class Duration>auto operator()(const sys_time<Duration>& t) const-> decltype(DestClock::from_sys(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion_)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const sys_time<Duration>& t) const
|
||||
-> decltype(DestClock::from_sys(t));
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3775)
|
||||
|
||||
*Constraints*: DestClock::from_sys(t) is well-formed[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3779)
|
||||
|
||||
*Mandates*: DestClock::from_sys(t) returns a time_point<DestClock, Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3784)
|
||||
|
||||
*Returns*: DestClock::from_sys(t)[.](#6.sentence-1)
|
||||
39
cppdraft/time/clock/cast/sys/utc.md
Normal file
39
cppdraft/time/clock/cast/sys/utc.md
Normal file
@@ -0,0 +1,39 @@
|
||||
[time.clock.cast.sys.utc]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#cast.sys.utc)
|
||||
|
||||
### 30.7.10 time_point conversions [[time.clock.cast]](time.clock.cast#sys.utc)
|
||||
|
||||
#### 30.7.10.3 Conversions between system_clock and utc_clock [time.clock.cast.sys.utc]
|
||||
|
||||
template<>struct clock_time_conversion<utc_clock, system_clock> {template<class Duration> utc_time<common_type_t<Duration, seconds>>operator()(const sys_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion)
|
||||
|
||||
`template<class Duration>
|
||||
utc_time<common_type_t<Duration, seconds>>
|
||||
operator()(const sys_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3698)
|
||||
|
||||
*Returns*: utc_clock::from_sys(t)[.](#1.sentence-1)
|
||||
|
||||
template<>struct clock_time_conversion<system_clock, utc_clock> {template<class Duration> sys_time<common_type_t<Duration, seconds>>operator()(const utc_time<Duration>& t) const;};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion_)
|
||||
|
||||
`template<class Duration>
|
||||
sys_time<common_type_t<Duration, seconds>>
|
||||
operator()(const utc_time<Duration>& t) const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3720)
|
||||
|
||||
*Returns*: utc_clock::to_sys(t)[.](#2.sentence-1)
|
||||
63
cppdraft/time/clock/cast/utc.md
Normal file
63
cppdraft/time/clock/cast/utc.md
Normal file
@@ -0,0 +1,63 @@
|
||||
[time.clock.cast.utc]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#cast.utc)
|
||||
|
||||
### 30.7.10 time_point conversions [[time.clock.cast]](time.clock.cast#utc)
|
||||
|
||||
#### 30.7.10.5 Conversions between utc_clock and other clocks [time.clock.cast.utc]
|
||||
|
||||
template<class SourceClock>struct clock_time_conversion<utc_clock, SourceClock> {template<class Duration>auto operator()(const time_point<SourceClock, Duration>& t) const-> decltype(SourceClock::to_utc(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const time_point<SourceClock, Duration>& t) const
|
||||
-> decltype(SourceClock::to_utc(t));
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3808)
|
||||
|
||||
*Constraints*: SourceClock::to_utc(t) is well-formed[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3812)
|
||||
|
||||
*Mandates*: SourceClock::to_utc(t) returns a utc_time<Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3817)
|
||||
|
||||
*Returns*: SourceClock::to_utc(t)[.](#3.sentence-1)
|
||||
|
||||
template<class DestClock>struct clock_time_conversion<DestClock, utc_clock> {template<class Duration>auto operator()(const utc_time<Duration>& t) const-> decltype(DestClock::from_utc(t));};
|
||||
|
||||
[ð](#lib:operator(),clock_time_conversion_)
|
||||
|
||||
`template<class Duration>
|
||||
auto operator()(const utc_time<Duration>& t) const
|
||||
-> decltype(DestClock::from_utc(t));
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3839)
|
||||
|
||||
*Constraints*: DestClock::from_utc(t) is well-formed[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3843)
|
||||
|
||||
*Mandates*: DestClock::from_utc(t) returns a time_point<DestClock, Duration2> for some type Duration2 ([[time.point.general]](time.point.general "30.6.1 General"))[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3848)
|
||||
|
||||
*Returns*: DestClock::from_utc(t)[.](#6.sentence-1)
|
||||
32
cppdraft/time/clock/conv.md
Normal file
32
cppdraft/time/clock/conv.md
Normal file
@@ -0,0 +1,32 @@
|
||||
[time.clock.conv]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#conv)
|
||||
|
||||
### 30.7.10 time_point conversions [[time.clock.cast]](time.clock.cast#time.clock.conv)
|
||||
|
||||
#### 30.7.10.1 Class template clock_time_conversion [time.clock.conv]
|
||||
|
||||
namespace std::chrono {template<class DestClock, class SourceClock>struct clock_time_conversion {};}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3583)
|
||||
|
||||
clock_time_conversion serves as a trait
|
||||
which can be used to specify how to convert
|
||||
a source time_point of typetime_point<SourceClock, Duration> to a destination time_point of typetime_point<DestClock, Duration> via a specialization:clock_time_conversion<DestClock, SourceClock>[.](#1.sentence-1)
|
||||
|
||||
A specialization of clock_time_conversion<DestClock, SourceClock> shall provide a const-qualified operator() that takes a parameter of type time_point<SourceClock, Duration> and returns a time_point<DestClock, OtherDuration> representing an equivalent point in time[.](#1.sentence-2)
|
||||
|
||||
OtherDuration is a chrono::duration whose specialization is computed from the input Duration in a manner which can vary for each clock_time_conversion specialization[.](#1.sentence-3)
|
||||
|
||||
A program may specialize clock_time_conversion if at least one of the template parameters is a user-defined clock type[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3603)
|
||||
|
||||
Several specializations are provided by the implementation,
|
||||
as described in[[time.clock.cast.id]](time.clock.cast.id "30.7.10.2 Identity conversions"),[[time.clock.cast.sys.utc]](time.clock.cast.sys.utc "30.7.10.3 Conversions between system_clock and utc_clock"),[[time.clock.cast.sys]](time.clock.cast.sys "30.7.10.4 Conversions between system_clock and other clocks"), and[[time.clock.cast.utc]](time.clock.cast.utc "30.7.10.5 Conversions between utc_clock and other clocks")[.](#2.sentence-1)
|
||||
94
cppdraft/time/clock/file.md
Normal file
94
cppdraft/time/clock/file.md
Normal file
@@ -0,0 +1,94 @@
|
||||
[time.clock.file]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#file)
|
||||
|
||||
### 30.7.6 Type file_clock [time.clock.file]
|
||||
|
||||
#### [30.7.6.1](#overview) Overview [[time.clock.file.overview]](time.clock.file.overview)
|
||||
|
||||
namespace std::chrono {using file_clock = *see below*;}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3369)
|
||||
|
||||
file_clock is an alias for a type
|
||||
meeting the [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") requirements ([[time.clock.req]](time.clock.req "30.3 Cpp17Clock requirements")), and
|
||||
using a signed arithmetic type for file_clock::rep[.](#overview-1.sentence-1)
|
||||
|
||||
file_clock is used to create the time_point system
|
||||
used for file_time_type ([[filesystems]](filesystems "31.12 File systems"))[.](#overview-1.sentence-2)
|
||||
|
||||
Its epoch is unspecified, andnoexcept(file_clock::now()) is true[.](#overview-1.sentence-3)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
The type that file_clock denotes can be
|
||||
in a different namespace than std::chrono,
|
||||
such as std::filesystem[.](#overview-1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [30.7.6.2](#members) Member functions [[time.clock.file.members]](time.clock.file.members)
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3386)
|
||||
|
||||
The type denoted by file_clock provides
|
||||
precisely one of the following two sets of static member functions:template<class Duration>static sys_time<*see below*> to_sys(const file_time<Duration>&);template<class Duration>static file_time<*see below*> from_sys(const sys_time<Duration>&); or:template<class Duration>static utc_time<*see below*> to_utc(const file_time<Duration>&);template<class Duration>static file_time<*see below*> from_utc(const utc_time<Duration>&);
|
||||
|
||||
These member functions shall provide time_point conversions
|
||||
consistent with those specified byutc_clock, tai_clock, and gps_clock[.](#members-1.sentence-2)
|
||||
|
||||
The Duration of the resultant time_point is computed from the Duration of the input time_point[.](#members-1.sentence-3)
|
||||
|
||||
#### [30.7.6.3](#nonmembers) Non-member functions [[time.clock.file.nonmembers]](time.clock.file.nonmembers)
|
||||
|
||||
[ð](#lib:operator%3c%3c,file_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const file_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3423)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[ð](#lib:from_stream,file_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
file_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3441)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the file_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-2.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#nonmembers-2.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-2.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-2.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp prior to assigning that difference to tp[.](#nonmembers-2.sentence-5)
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3457)
|
||||
|
||||
*Returns*: is[.](#nonmembers-3.sentence-1)
|
||||
21
cppdraft/time/clock/file/members.md
Normal file
21
cppdraft/time/clock/file/members.md
Normal file
@@ -0,0 +1,21 @@
|
||||
[time.clock.file.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#file.members)
|
||||
|
||||
### 30.7.6 Type file_clock [[time.clock.file]](time.clock.file#members)
|
||||
|
||||
#### 30.7.6.2 Member functions [time.clock.file.members]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3386)
|
||||
|
||||
The type denoted by file_clock provides
|
||||
precisely one of the following two sets of static member functions:template<class Duration>static sys_time<*see below*> to_sys(const file_time<Duration>&);template<class Duration>static file_time<*see below*> from_sys(const sys_time<Duration>&); or:template<class Duration>static utc_time<*see below*> to_utc(const file_time<Duration>&);template<class Duration>static file_time<*see below*> from_utc(const utc_time<Duration>&);
|
||||
|
||||
These member functions shall provide time_point conversions
|
||||
consistent with those specified byutc_clock, tai_clock, and gps_clock[.](#1.sentence-2)
|
||||
|
||||
The Duration of the resultant time_point is computed from the Duration of the input time_point[.](#1.sentence-3)
|
||||
55
cppdraft/time/clock/file/nonmembers.md
Normal file
55
cppdraft/time/clock/file/nonmembers.md
Normal file
@@ -0,0 +1,55 @@
|
||||
[time.clock.file.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#file.nonmembers)
|
||||
|
||||
### 30.7.6 Type file_clock [[time.clock.file]](time.clock.file#nonmembers)
|
||||
|
||||
#### 30.7.6.3 Non-member functions [time.clock.file.nonmembers]
|
||||
|
||||
[ð](#lib:operator%3c%3c,file_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const file_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3423)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[ð](#lib:from_stream,file_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
file_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3441)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the file_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#2.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#2.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#2.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#2.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp prior to assigning that difference to tp[.](#2.sentence-5)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3457)
|
||||
|
||||
*Returns*: is[.](#3.sentence-1)
|
||||
32
cppdraft/time/clock/file/overview.md
Normal file
32
cppdraft/time/clock/file/overview.md
Normal file
@@ -0,0 +1,32 @@
|
||||
[time.clock.file.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#file.overview)
|
||||
|
||||
### 30.7.6 Type file_clock [[time.clock.file]](time.clock.file#overview)
|
||||
|
||||
#### 30.7.6.1 Overview [time.clock.file.overview]
|
||||
|
||||
namespace std::chrono {using file_clock = *see below*;}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3369)
|
||||
|
||||
file_clock is an alias for a type
|
||||
meeting the [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") requirements ([[time.clock.req]](time.clock.req "30.3 Cpp17Clock requirements")), and
|
||||
using a signed arithmetic type for file_clock::rep[.](#1.sentence-1)
|
||||
|
||||
file_clock is used to create the time_point system
|
||||
used for file_time_type ([[filesystems]](filesystems "31.12 File systems"))[.](#1.sentence-2)
|
||||
|
||||
Its epoch is unspecified, andnoexcept(file_clock::now()) is true[.](#1.sentence-3)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The type that file_clock denotes can be
|
||||
in a different namespace than std::chrono,
|
||||
such as std::filesystem[.](#1.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
14
cppdraft/time/clock/general.md
Normal file
14
cppdraft/time/clock/general.md
Normal file
@@ -0,0 +1,14 @@
|
||||
[time.clock.general]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#general)
|
||||
|
||||
### 30.7.1 General [time.clock.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2633)
|
||||
|
||||
The types defined in [[time.clock]](time.clock "30.7 Clocks") meet the[*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") requirements ([[time.clock.req]](time.clock.req "30.3 Cpp17Clock requirements"))
|
||||
unless otherwise specified[.](#1.sentence-1)
|
||||
146
cppdraft/time/clock/gps.md
Normal file
146
cppdraft/time/clock/gps.md
Normal file
@@ -0,0 +1,146 @@
|
||||
[time.clock.gps]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#gps)
|
||||
|
||||
### 30.7.5 Class gps_clock [time.clock.gps]
|
||||
|
||||
#### [30.7.5.1](#overview) Overview [[time.clock.gps.overview]](time.clock.gps.overview)
|
||||
|
||||
namespace std::chrono {class gps_clock {public:using rep = *a signed arithmetic type*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<gps_clock>; static constexpr bool is_steady = *unspecified*; static time_point now(); template<class Duration>static utc_time<common_type_t<Duration, seconds>> to_utc(const gps_time<Duration>&) noexcept; template<class Duration>static gps_time<common_type_t<Duration, seconds>> from_utc(const utc_time<Duration>&) noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3223)
|
||||
|
||||
The clock gps_clock measures
|
||||
seconds since the first Sunday of January, 1980 00:00:00 UTC[.](#overview-1.sentence-1)
|
||||
|
||||
Leap seconds are not inserted into GPS[.](#overview-1.sentence-2)
|
||||
|
||||
Therefore every time a leap second is inserted into UTC,
|
||||
UTC shifts another second with respect to GPS[.](#overview-1.sentence-3)
|
||||
|
||||
Aside from the offset from 1958y/January/1 to 1980y/January/Sunday[1],
|
||||
GPS is behind TAI by 19s due to the 10s offset between 1958 and 1970
|
||||
and the additional 9 leap seconds inserted between 1970 and 1980[.](#overview-1.sentence-4)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3233)
|
||||
|
||||
gps_clock is not a [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") unless the implementation can guarantee thatgps_clock::now() does not propagate an exception[.](#overview-2.sentence-1)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
noexcept(from_utc(utc_clock::now())) is false[.](#overview-2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [30.7.5.2](#members) Member functions [[time.clock.gps.members]](time.clock.gps.members)
|
||||
|
||||
[ð](#lib:now,gps_clock)
|
||||
|
||||
`static time_point now();
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3249)
|
||||
|
||||
*Returns*: from_utc(utc_clock::now()), or a more accurate value of gps_time[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:to_utc,gps_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static utc_time<common_type_t<Duration, seconds>>
|
||||
to_utc(const gps_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3262)
|
||||
|
||||
*Returns*: utc_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} + 315964809s
|
||||
|
||||
[*Note [1](#members-note-1)*: 315964809s == sys_days{1980y/January/Sunday[1]} - sys_days{1970y/January/1} + 9s â *end note*]
|
||||
|
||||
[ð](#lib:from_utc,gps_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static gps_time<common_type_t<Duration, seconds>>
|
||||
from_utc(const utc_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3282)
|
||||
|
||||
*Returns*: gps_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} - 315964809s
|
||||
|
||||
[*Note [2](#members-note-2)*: 315964809s == sys_days{1980y/January/Sunday[1]} - sys_days{1970y/January/1} + 9s â *end note*]
|
||||
|
||||
#### [30.7.5.3](#nonmembers) Non-member functions [[time.clock.gps.nonmembers]](time.clock.gps.nonmembers)
|
||||
|
||||
[ð](#lib:operator%3c%3c,gps_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const gps_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3304)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3311)
|
||||
|
||||
[*Example [1](#nonmembers-example-1)*: auto st = sys_days{2000y/January/1};auto gt = clock_cast<gps_clock>(st);
|
||||
cout << format("{0:%F %T %Z} == {1:%F %T %Z}\n", st, gt);
|
||||
|
||||
Produces this output:
|
||||
|
||||
```
|
||||
2000-01-01 00:00:00 UTC == 2000-01-01 00:00:13 GPS
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:from_stream,gps_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
gps_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3337)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the gps_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-3.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#nonmembers-3.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-3.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-3.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp prior to assigning that difference to tp[.](#nonmembers-3.sentence-5)
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3353)
|
||||
|
||||
*Returns*: is[.](#nonmembers-4.sentence-1)
|
||||
50
cppdraft/time/clock/gps/members.md
Normal file
50
cppdraft/time/clock/gps/members.md
Normal file
@@ -0,0 +1,50 @@
|
||||
[time.clock.gps.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#gps.members)
|
||||
|
||||
### 30.7.5 Class gps_clock [[time.clock.gps]](time.clock.gps#members)
|
||||
|
||||
#### 30.7.5.2 Member functions [time.clock.gps.members]
|
||||
|
||||
[ð](#lib:now,gps_clock)
|
||||
|
||||
`static time_point now();
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3249)
|
||||
|
||||
*Returns*: from_utc(utc_clock::now()), or a more accurate value of gps_time[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:to_utc,gps_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static utc_time<common_type_t<Duration, seconds>>
|
||||
to_utc(const gps_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3262)
|
||||
|
||||
*Returns*: utc_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} + 315964809s
|
||||
|
||||
[*Note [1](#note-1)*: 315964809s == sys_days{1980y/January/Sunday[1]} - sys_days{1970y/January/1} + 9s â *end note*]
|
||||
|
||||
[ð](#lib:from_utc,gps_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static gps_time<common_type_t<Duration, seconds>>
|
||||
from_utc(const utc_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3282)
|
||||
|
||||
*Returns*: gps_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} - 315964809s
|
||||
|
||||
[*Note [2](#note-2)*: 315964809s == sys_days{1980y/January/Sunday[1]} - sys_days{1970y/January/1} + 9s â *end note*]
|
||||
71
cppdraft/time/clock/gps/nonmembers.md
Normal file
71
cppdraft/time/clock/gps/nonmembers.md
Normal file
@@ -0,0 +1,71 @@
|
||||
[time.clock.gps.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#gps.nonmembers)
|
||||
|
||||
### 30.7.5 Class gps_clock [[time.clock.gps]](time.clock.gps#nonmembers)
|
||||
|
||||
#### 30.7.5.3 Non-member functions [time.clock.gps.nonmembers]
|
||||
|
||||
[ð](#lib:operator%3c%3c,gps_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const gps_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3304)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3311)
|
||||
|
||||
[*Example [1](#example-1)*: auto st = sys_days{2000y/January/1};auto gt = clock_cast<gps_clock>(st);
|
||||
cout << format("{0:%F %T %Z} == {1:%F %T %Z}\n", st, gt);
|
||||
|
||||
Produces this output:
|
||||
|
||||
```
|
||||
2000-01-01 00:00:00 UTC == 2000-01-01 00:00:13 GPS
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:from_stream,gps_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
gps_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3337)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the gps_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#3.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#3.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#3.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#3.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp prior to assigning that difference to tp[.](#3.sentence-5)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3353)
|
||||
|
||||
*Returns*: is[.](#4.sentence-1)
|
||||
39
cppdraft/time/clock/gps/overview.md
Normal file
39
cppdraft/time/clock/gps/overview.md
Normal file
@@ -0,0 +1,39 @@
|
||||
[time.clock.gps.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#gps.overview)
|
||||
|
||||
### 30.7.5 Class gps_clock [[time.clock.gps]](time.clock.gps#overview)
|
||||
|
||||
#### 30.7.5.1 Overview [time.clock.gps.overview]
|
||||
|
||||
namespace std::chrono {class gps_clock {public:using rep = *a signed arithmetic type*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<gps_clock>; static constexpr bool is_steady = *unspecified*; static time_point now(); template<class Duration>static utc_time<common_type_t<Duration, seconds>> to_utc(const gps_time<Duration>&) noexcept; template<class Duration>static gps_time<common_type_t<Duration, seconds>> from_utc(const utc_time<Duration>&) noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3223)
|
||||
|
||||
The clock gps_clock measures
|
||||
seconds since the first Sunday of January, 1980 00:00:00 UTC[.](#1.sentence-1)
|
||||
|
||||
Leap seconds are not inserted into GPS[.](#1.sentence-2)
|
||||
|
||||
Therefore every time a leap second is inserted into UTC,
|
||||
UTC shifts another second with respect to GPS[.](#1.sentence-3)
|
||||
|
||||
Aside from the offset from 1958y/January/1 to 1980y/January/Sunday[1],
|
||||
GPS is behind TAI by 19s due to the 10s offset between 1958 and 1970
|
||||
and the additional 9 leap seconds inserted between 1970 and 1980[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3233)
|
||||
|
||||
gps_clock is not a [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") unless the implementation can guarantee thatgps_clock::now() does not propagate an exception[.](#2.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
noexcept(from_utc(utc_clock::now())) is false[.](#2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
18
cppdraft/time/clock/hires.md
Normal file
18
cppdraft/time/clock/hires.md
Normal file
@@ -0,0 +1,18 @@
|
||||
[time.clock.hires]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#hires)
|
||||
|
||||
### 30.7.8 Class high_resolution_clock [time.clock.hires]
|
||||
|
||||
namespace std::chrono {class high_resolution_clock {public:using rep = *unspecified*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<*unspecified*, duration>; static constexpr bool is_steady = *unspecified*; static time_point now() noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3503)
|
||||
|
||||
Objects of class high_resolution_clock represent clocks with the
|
||||
shortest tick period[.](#1.sentence-1)
|
||||
|
||||
high_resolution_clock may be a synonym forsystem_clock or steady_clock[.](#1.sentence-2)
|
||||
72
cppdraft/time/clock/local.md
Normal file
72
cppdraft/time/clock/local.md
Normal file
@@ -0,0 +1,72 @@
|
||||
[time.clock.local]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#local)
|
||||
|
||||
### 30.7.9 Local time [time.clock.local]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3511)
|
||||
|
||||
The family of time points
|
||||
denoted by local_time<Duration> are based on the pseudo clock local_t[.](#1.sentence-1)
|
||||
|
||||
local_t has no member now() and thus does not meet the clock requirements[.](#1.sentence-2)
|
||||
|
||||
Nevertheless local_time<Duration> serves the vital role of
|
||||
representing local time with respect to a not-yet-specified time zone[.](#1.sentence-3)
|
||||
|
||||
Aside from being able to get the current time,
|
||||
the complete time_point algebra is available
|
||||
for local_time<Duration> (just as for sys_time<Duration>)[.](#1.sentence-4)
|
||||
|
||||
[ð](#lib:operator%3c%3c,local_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const local_time<Duration>& lt);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3531)
|
||||
|
||||
*Effects*: os << sys_time<Duration>{lt.time_since_epoch()};
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3537)
|
||||
|
||||
*Returns*: os[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:from_stream,local_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
local_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3552)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the local_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#4.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#4.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#4.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#4.sentence-4)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3566)
|
||||
|
||||
*Returns*: is[.](#5.sentence-1)
|
||||
83
cppdraft/time/clock/req.md
Normal file
83
cppdraft/time/clock/req.md
Normal file
@@ -0,0 +1,83 @@
|
||||
[time.clock.req]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.3 *Cpp17Clock* requirements [time.clock.req]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L976)
|
||||
|
||||
A clock is a bundle consisting of a duration, atime_point, and a function now() to get the current time_point[.](#1.sentence-1)
|
||||
|
||||
The origin of the clock's time_point is referred to as the clock's [*epoch*](#def:epoch "30.3 Cpp17Clock requirements [time.clock.req]")[.](#1.sentence-2)
|
||||
|
||||
A clock shall meet the requirements in Table [131](#tab:time.clock "Table 131: Cpp17Clock requirements")[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L982)
|
||||
|
||||
In Table [131](#tab:time.clock "Table 131: Cpp17Clock requirements") C1 and C2 denote clock types[.](#2.sentence-1)
|
||||
|
||||
t1 andt2 are values returned by C1::now() where the call returning t1 happens
|
||||
before ([[intro.multithread]](intro.multithread "6.10.2 Multi-threaded executions and data races")) the call returning t2 and both of these calls
|
||||
occur
|
||||
before C1::time_point::max()[.](#2.sentence-2)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This means C1 did not wrap around between t1 andt2[.](#2.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
Table [131](#tab:time.clock) — *Cpp17Clock* requirements [[tab:time.clock]](./tab:time.clock)
|
||||
|
||||
| [ð](#tab:time.clock-row-1)<br>**Expression** | **Return type** | **Operational semantics** |
|
||||
| --- | --- | --- |
|
||||
| [ð](#tab:time.clock-row-2)<br>C1::rep | An arithmetic type or a class emulating an arithmetic type | The representation type of C1::duration[.](#tab:time.clock-row-2-column-3-sentence-1) |
|
||||
| [ð](#tab:time.clock-row-3)<br>C1::period | a specialization of ratio | The tick period of the clock in seconds[.](#tab:time.clock-row-3-column-3-sentence-1) |
|
||||
| [ð](#tab:time.clock-row-4)<br>C1::duration | chrono::duration<C1::rep, C1::period> | The duration type of the clock[.](#tab:time.clock-row-4-column-3-sentence-1) |
|
||||
| [ð](#tab:time.clock-row-5)<br>C1::time_point | chrono::time_point<C1> or chrono::time_point<C2, C1::duration> | The time_point type of the clock[.](#tab:time.clock-row-5-column-3-sentence-1)<br>C1 and C2 shall refer to the same epoch[.](#tab:time.clock-row-5-column-3-sentence-2) |
|
||||
| [ð](#tab:time.clock-row-6)<br>C1::is_steady | const bool | true if t1 <= t2 is always true and the time between clock ticks is constant, otherwise false[.](#tab:time.clock-row-6-column-3-sentence-1) |
|
||||
| [ð](#tab:time.clock-row-7)<br>C1::now() | C1::time_point | Returns a time_point object representing the current point in time[.](#tab:time.clock-row-7-column-3-sentence-1) |
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1032)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
The relative difference in durations between those reported by a given clock and the
|
||||
SI definition is a measure of the quality of implementation[.](#3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1038)
|
||||
|
||||
A type TC meets the *Cpp17TrivialClock* requirements if
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
TC meets the [*Cpp17Clock*](#:Cpp17Clock "30.3 Cpp17Clock requirements [time.clock.req]") requirements,
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
the types TC::rep, TC::duration, and TC::time_point meet the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and[*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements"))
|
||||
and [*Cpp17Swappable*](swappable.requirements#:Cpp17Swappable "16.4.4.3 Swappable requirements [swappable.requirements]") ([[swappable.requirements]](swappable.requirements "16.4.4.3 Swappable requirements"))
|
||||
requirements and the requirements of
|
||||
numeric types ([[numeric.requirements]](numeric.requirements "29.2 Numeric type requirements")),
|
||||
[*Note [3](#note-3)*:
|
||||
This means, in particular,
|
||||
that operations on these types will not throw exceptions[.](#4.2.sentence-1)
|
||||
â *end note*]
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
the function TC::now() does not throw exceptions, and
|
||||
|
||||
- [(4.4)](#4.4)
|
||||
|
||||
the type TC::time_point::clock meets the *Cpp17TrivialClock* requirements, recursively[.](#4.sentence-1)
|
||||
18
cppdraft/time/clock/steady.md
Normal file
18
cppdraft/time/clock/steady.md
Normal file
@@ -0,0 +1,18 @@
|
||||
[time.clock.steady]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#steady)
|
||||
|
||||
### 30.7.7 Class steady_clock [time.clock.steady]
|
||||
|
||||
namespace std::chrono {class steady_clock {public:using rep = *unspecified*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<*unspecified*, duration>; static constexpr bool is_steady = true; static time_point now() noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3480)
|
||||
|
||||
Objects of class steady_clock represent clocks for which values of time_point never decrease as physical time advances and for which values of time_point advance at
|
||||
a steady rate relative to real time[.](#1.sentence-1)
|
||||
|
||||
That is, the clock may not be adjusted[.](#1.sentence-2)
|
||||
166
cppdraft/time/clock/system.md
Normal file
166
cppdraft/time/clock/system.md
Normal file
@@ -0,0 +1,166 @@
|
||||
[time.clock.system]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#system)
|
||||
|
||||
### 30.7.2 Class system_clock [time.clock.system]
|
||||
|
||||
#### [30.7.2.1](#overview) Overview [[time.clock.system.overview]](time.clock.system.overview)
|
||||
|
||||
namespace std::chrono {class system_clock {public:using rep = *see below*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<system_clock>; static constexpr bool is_steady = *unspecified*; static time_point now() noexcept; // mapping to/from C type time_tstatic time_t to_time_t (const time_point& t) noexcept; static time_point from_time_t(time_t t) noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2663)
|
||||
|
||||
Objects of type system_clock represent wall clock time from the system-wide
|
||||
realtime clock[.](#overview-1.sentence-1)
|
||||
|
||||
Objects of type sys_time<Duration> measure time since
|
||||
1970-01-01 00:00:00 UTC excluding leap seconds[.](#overview-1.sentence-2)
|
||||
|
||||
This measure is commonly referred to as [*Unix time*](#def:Unix_time "30.7.2.1 Overview [time.clock.system.overview]")[.](#overview-1.sentence-3)
|
||||
|
||||
This measure facilitates an efficient mapping betweensys_time and calendar types ([[time.cal]](time.cal "30.8 The civil calendar"))[.](#overview-1.sentence-4)
|
||||
|
||||
[*Example [1](#overview-example-1)*:
|
||||
|
||||
|
||||
sys_seconds{sys_days{1970y/January/1}}.time_since_epoch() is 0s[.](#overview-1.sentence-5)
|
||||
|
||||
|
||||
|
||||
|
||||
sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946'684'800s,
|
||||
which is 10'957 * 86'400s[.](#overview-1.sentence-6)
|
||||
|
||||
|
||||
â *end example*]
|
||||
|
||||
#### [30.7.2.2](#members) Members [[time.clock.system.members]](time.clock.system.members)
|
||||
|
||||
[ð](#lib:rep,system_clock)
|
||||
|
||||
`using system_clock::rep = unspecified;
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2686)
|
||||
|
||||
*Constraints*: system_clock::duration::min() < system_clock::duration::zero() is true[.](#members-1.sentence-1)
|
||||
|
||||
[*Note [1](#members-note-1)*:
|
||||
|
||||
This implies that rep is a signed type[.](#members-1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:to_time_t,system_clock)
|
||||
|
||||
`static time_t to_time_t(const time_point& t) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2700)
|
||||
|
||||
*Returns*: A time_t object that represents the same point in time as t when both values are restricted to the coarser of the precisions of time_t andtime_point[.](#members-2.sentence-1)
|
||||
|
||||
It is implementation-defined
|
||||
whether values are rounded or truncated to the required precision[.](#members-2.sentence-2)
|
||||
|
||||
[ð](#lib:from_time_t,system_clock)
|
||||
|
||||
`static time_point from_time_t(time_t t) noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2716)
|
||||
|
||||
*Returns*: A time_point object that represents the same point in time as t when both values are restricted to the coarser of the precisions of time_t andtime_point[.](#members-3.sentence-1)
|
||||
|
||||
It is implementation-defined
|
||||
whether values are rounded or truncated to the required precision[.](#members-3.sentence-2)
|
||||
|
||||
#### [30.7.2.3](#nonmembers) Non-member functions [[time.clock.system.nonmembers]](time.clock.system.nonmembers)
|
||||
|
||||
[ð](#lib:operator%3c%3c,sys_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const sys_time<Duration>& tp);
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2736)
|
||||
|
||||
*Constraints*: treat_as_floating_point_v<typename Duration::rep> is false, andDuration{1} < days{1} is true[.](#nonmembers-1.sentence-1)
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2741)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), tp);
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2748)
|
||||
|
||||
[*Example [1](#nonmembers-example-1)*: cout << sys_seconds{0s} << '\n'; // 1970-01-01 00:00:00 cout << sys_seconds{946'684'800s} << '\n'; // 2000-01-01 00:00:00 cout << sys_seconds{946'688'523s} << '\n'; // 2000-01-01 01:02:03 â *end example*]
|
||||
|
||||
[ð](#lib:operator%3c%3c,sys_days)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const sys_days& dp);
|
||||
`
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2766)
|
||||
|
||||
*Effects*: os << year_month_day{dp}[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2770)
|
||||
|
||||
*Returns*: os[.](#nonmembers-5.sentence-1)
|
||||
|
||||
[ð](#lib:from_stream,sys_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
sys_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2785)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the sys_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-6.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#nonmembers-6.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-6.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-6.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted
|
||||
from the successfully parsed timestamp
|
||||
prior to assigning that difference to tp[.](#nonmembers-6.sentence-5)
|
||||
|
||||
[7](#nonmembers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2802)
|
||||
|
||||
*Returns*: is[.](#nonmembers-7.sentence-1)
|
||||
54
cppdraft/time/clock/system/members.md
Normal file
54
cppdraft/time/clock/system/members.md
Normal file
@@ -0,0 +1,54 @@
|
||||
[time.clock.system.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#system.members)
|
||||
|
||||
### 30.7.2 Class system_clock [[time.clock.system]](time.clock.system#members)
|
||||
|
||||
#### 30.7.2.2 Members [time.clock.system.members]
|
||||
|
||||
[ð](#lib:rep,system_clock)
|
||||
|
||||
`using system_clock::rep = unspecified;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2686)
|
||||
|
||||
*Constraints*: system_clock::duration::min() < system_clock::duration::zero() is true[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This implies that rep is a signed type[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:to_time_t,system_clock)
|
||||
|
||||
`static time_t to_time_t(const time_point& t) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2700)
|
||||
|
||||
*Returns*: A time_t object that represents the same point in time as t when both values are restricted to the coarser of the precisions of time_t andtime_point[.](#2.sentence-1)
|
||||
|
||||
It is implementation-defined
|
||||
whether values are rounded or truncated to the required precision[.](#2.sentence-2)
|
||||
|
||||
[ð](#lib:from_time_t,system_clock)
|
||||
|
||||
`static time_point from_time_t(time_t t) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2716)
|
||||
|
||||
*Returns*: A time_point object that represents the same point in time as t when both values are restricted to the coarser of the precisions of time_t andtime_point[.](#3.sentence-1)
|
||||
|
||||
It is implementation-defined
|
||||
whether values are rounded or truncated to the required precision[.](#3.sentence-2)
|
||||
87
cppdraft/time/clock/system/nonmembers.md
Normal file
87
cppdraft/time/clock/system/nonmembers.md
Normal file
@@ -0,0 +1,87 @@
|
||||
[time.clock.system.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#system.nonmembers)
|
||||
|
||||
### 30.7.2 Class system_clock [[time.clock.system]](time.clock.system#nonmembers)
|
||||
|
||||
#### 30.7.2.3 Non-member functions [time.clock.system.nonmembers]
|
||||
|
||||
[ð](#lib:operator%3c%3c,sys_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const sys_time<Duration>& tp);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2736)
|
||||
|
||||
*Constraints*: treat_as_floating_point_v<typename Duration::rep> is false, andDuration{1} < days{1} is true[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2741)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), tp);
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2748)
|
||||
|
||||
[*Example [1](#example-1)*: cout << sys_seconds{0s} << '\n'; // 1970-01-01 00:00:00 cout << sys_seconds{946'684'800s} << '\n'; // 2000-01-01 00:00:00 cout << sys_seconds{946'688'523s} << '\n'; // 2000-01-01 01:02:03 â *end example*]
|
||||
|
||||
[ð](#lib:operator%3c%3c,sys_days)
|
||||
|
||||
`template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const sys_days& dp);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2766)
|
||||
|
||||
*Effects*: os << year_month_day{dp}[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2770)
|
||||
|
||||
*Returns*: os[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:from_stream,sys_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
sys_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2785)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the sys_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#6.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#6.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#6.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#6.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted
|
||||
from the successfully parsed timestamp
|
||||
prior to assigning that difference to tp[.](#6.sentence-5)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2802)
|
||||
|
||||
*Returns*: is[.](#7.sentence-1)
|
||||
39
cppdraft/time/clock/system/overview.md
Normal file
39
cppdraft/time/clock/system/overview.md
Normal file
@@ -0,0 +1,39 @@
|
||||
[time.clock.system.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#system.overview)
|
||||
|
||||
### 30.7.2 Class system_clock [[time.clock.system]](time.clock.system#overview)
|
||||
|
||||
#### 30.7.2.1 Overview [time.clock.system.overview]
|
||||
|
||||
namespace std::chrono {class system_clock {public:using rep = *see below*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<system_clock>; static constexpr bool is_steady = *unspecified*; static time_point now() noexcept; // mapping to/from C type time_tstatic time_t to_time_t (const time_point& t) noexcept; static time_point from_time_t(time_t t) noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2663)
|
||||
|
||||
Objects of type system_clock represent wall clock time from the system-wide
|
||||
realtime clock[.](#1.sentence-1)
|
||||
|
||||
Objects of type sys_time<Duration> measure time since
|
||||
1970-01-01 00:00:00 UTC excluding leap seconds[.](#1.sentence-2)
|
||||
|
||||
This measure is commonly referred to as [*Unix time*](#def:Unix_time "30.7.2.1 Overview [time.clock.system.overview]")[.](#1.sentence-3)
|
||||
|
||||
This measure facilitates an efficient mapping betweensys_time and calendar types ([[time.cal]](time.cal "30.8 The civil calendar"))[.](#1.sentence-4)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
|
||||
sys_seconds{sys_days{1970y/January/1}}.time_since_epoch() is 0s[.](#1.sentence-5)
|
||||
|
||||
|
||||
|
||||
|
||||
sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946'684'800s,
|
||||
which is 10'957 * 86'400s[.](#1.sentence-6)
|
||||
|
||||
|
||||
â *end example*]
|
||||
149
cppdraft/time/clock/tai.md
Normal file
149
cppdraft/time/clock/tai.md
Normal file
@@ -0,0 +1,149 @@
|
||||
[time.clock.tai]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#tai)
|
||||
|
||||
### 30.7.4 Class tai_clock [time.clock.tai]
|
||||
|
||||
#### [30.7.4.1](#overview) Overview [[time.clock.tai.overview]](time.clock.tai.overview)
|
||||
|
||||
namespace std::chrono {class tai_clock {public:using rep = *a signed arithmetic type*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<tai_clock>; static constexpr bool is_steady = *unspecified*; static time_point now(); template<class Duration>static utc_time<common_type_t<Duration, seconds>> to_utc(const tai_time<Duration>&) noexcept; template<class Duration>static tai_time<common_type_t<Duration, seconds>> from_utc(const utc_time<Duration>&) noexcept; };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3059)
|
||||
|
||||
The clock tai_clock measures seconds since 1958-01-01 00:00:00
|
||||
and is offset 10s ahead of UTC at this date[.](#overview-1.sentence-1)
|
||||
|
||||
That is, 1958-01-01 00:00:00 TAI is equivalent to 1957-12-31 23:59:50 UTC[.](#overview-1.sentence-2)
|
||||
|
||||
Leap seconds are not inserted into TAI[.](#overview-1.sentence-3)
|
||||
|
||||
Therefore every time a leap second is inserted into UTC,
|
||||
UTC shifts another second with respect to TAI[.](#overview-1.sentence-4)
|
||||
|
||||
For example by 2000-01-01 there had been
|
||||
22 positive and 0 negative leap seconds inserted
|
||||
so 2000-01-01 00:00:00 UTC is equivalent to 2000-01-01 00:00:32 TAI
|
||||
(22s plus the initial 10s offset)[.](#overview-1.sentence-5)
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3071)
|
||||
|
||||
tai_clock is not a [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") unless the implementation can guarantee that tai_clock::now() does not propagate an exception[.](#overview-2.sentence-1)
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
noexcept(from_utc(utc_clock::now())) is false[.](#overview-2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [30.7.4.2](#members) Member functions [[time.clock.tai.members]](time.clock.tai.members)
|
||||
|
||||
[ð](#lib:now,tai_clock)
|
||||
|
||||
`static time_point now();
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3087)
|
||||
|
||||
*Returns*: from_utc(utc_clock::now()), or a more accurate value of tai_time[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:to_utc,tai_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static utc_time<common_type_t<Duration, seconds>>
|
||||
to_utc(const tai_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3100)
|
||||
|
||||
*Returns*: utc_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} - 378691210s
|
||||
|
||||
[*Note [1](#members-note-1)*: 378691210s == sys_days{1970y/January/1} - sys_days{1958y/January/1} + 10s â *end note*]
|
||||
|
||||
[ð](#lib:from_utc,tai_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static tai_time<common_type_t<Duration, seconds>>
|
||||
from_utc(const utc_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3120)
|
||||
|
||||
*Returns*: tai_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} + 378691210s
|
||||
|
||||
[*Note [2](#members-note-2)*: 378691210s == sys_days{1970y/January/1} - sys_days{1958y/January/1} + 10s â *end note*]
|
||||
|
||||
#### [30.7.4.3](#nonmembers) Non-member functions [[time.clock.tai.nonmembers]](time.clock.tai.nonmembers)
|
||||
|
||||
[ð](#lib:operator%3c%3c,tai_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const tai_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3142)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3149)
|
||||
|
||||
[*Example [1](#nonmembers-example-1)*: auto st = sys_days{2000y/January/1};auto tt = clock_cast<tai_clock>(st);
|
||||
cout << format("{0:%F %T %Z} == {1:%F %T %Z}\n", st, tt);
|
||||
|
||||
Produces this output:
|
||||
|
||||
```
|
||||
2000-01-01 00:00:00 UTC == 2000-01-01 00:00:32 TAI
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:from_stream,tai_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
tai_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3175)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the tai_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-3.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#nonmembers-3.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-3.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-3.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp prior to assigning that difference to tp[.](#nonmembers-3.sentence-5)
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3191)
|
||||
|
||||
*Returns*: is[.](#nonmembers-4.sentence-1)
|
||||
50
cppdraft/time/clock/tai/members.md
Normal file
50
cppdraft/time/clock/tai/members.md
Normal file
@@ -0,0 +1,50 @@
|
||||
[time.clock.tai.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#tai.members)
|
||||
|
||||
### 30.7.4 Class tai_clock [[time.clock.tai]](time.clock.tai#members)
|
||||
|
||||
#### 30.7.4.2 Member functions [time.clock.tai.members]
|
||||
|
||||
[ð](#lib:now,tai_clock)
|
||||
|
||||
`static time_point now();
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3087)
|
||||
|
||||
*Returns*: from_utc(utc_clock::now()), or a more accurate value of tai_time[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:to_utc,tai_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static utc_time<common_type_t<Duration, seconds>>
|
||||
to_utc(const tai_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3100)
|
||||
|
||||
*Returns*: utc_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} - 378691210s
|
||||
|
||||
[*Note [1](#note-1)*: 378691210s == sys_days{1970y/January/1} - sys_days{1958y/January/1} + 10s â *end note*]
|
||||
|
||||
[ð](#lib:from_utc,tai_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static tai_time<common_type_t<Duration, seconds>>
|
||||
from_utc(const utc_time<Duration>& t) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3120)
|
||||
|
||||
*Returns*: tai_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} + 378691210s
|
||||
|
||||
[*Note [2](#note-2)*: 378691210s == sys_days{1970y/January/1} - sys_days{1958y/January/1} + 10s â *end note*]
|
||||
71
cppdraft/time/clock/tai/nonmembers.md
Normal file
71
cppdraft/time/clock/tai/nonmembers.md
Normal file
@@ -0,0 +1,71 @@
|
||||
[time.clock.tai.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#tai.nonmembers)
|
||||
|
||||
### 30.7.4 Class tai_clock [[time.clock.tai]](time.clock.tai#nonmembers)
|
||||
|
||||
#### 30.7.4.3 Non-member functions [time.clock.tai.nonmembers]
|
||||
|
||||
[ð](#lib:operator%3c%3c,tai_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const tai_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3142)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3149)
|
||||
|
||||
[*Example [1](#example-1)*: auto st = sys_days{2000y/January/1};auto tt = clock_cast<tai_clock>(st);
|
||||
cout << format("{0:%F %T %Z} == {1:%F %T %Z}\n", st, tt);
|
||||
|
||||
Produces this output:
|
||||
|
||||
```
|
||||
2000-01-01 00:00:00 UTC == 2000-01-01 00:00:32 TAI
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:from_stream,tai_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
tai_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3175)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the tai_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#3.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#3.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#3.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#3.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp prior to assigning that difference to tp[.](#3.sentence-5)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3191)
|
||||
|
||||
*Returns*: is[.](#4.sentence-1)
|
||||
42
cppdraft/time/clock/tai/overview.md
Normal file
42
cppdraft/time/clock/tai/overview.md
Normal file
@@ -0,0 +1,42 @@
|
||||
[time.clock.tai.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#tai.overview)
|
||||
|
||||
### 30.7.4 Class tai_clock [[time.clock.tai]](time.clock.tai#overview)
|
||||
|
||||
#### 30.7.4.1 Overview [time.clock.tai.overview]
|
||||
|
||||
namespace std::chrono {class tai_clock {public:using rep = *a signed arithmetic type*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<tai_clock>; static constexpr bool is_steady = *unspecified*; static time_point now(); template<class Duration>static utc_time<common_type_t<Duration, seconds>> to_utc(const tai_time<Duration>&) noexcept; template<class Duration>static tai_time<common_type_t<Duration, seconds>> from_utc(const utc_time<Duration>&) noexcept; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3059)
|
||||
|
||||
The clock tai_clock measures seconds since 1958-01-01 00:00:00
|
||||
and is offset 10s ahead of UTC at this date[.](#1.sentence-1)
|
||||
|
||||
That is, 1958-01-01 00:00:00 TAI is equivalent to 1957-12-31 23:59:50 UTC[.](#1.sentence-2)
|
||||
|
||||
Leap seconds are not inserted into TAI[.](#1.sentence-3)
|
||||
|
||||
Therefore every time a leap second is inserted into UTC,
|
||||
UTC shifts another second with respect to TAI[.](#1.sentence-4)
|
||||
|
||||
For example by 2000-01-01 there had been
|
||||
22 positive and 0 negative leap seconds inserted
|
||||
so 2000-01-01 00:00:00 UTC is equivalent to 2000-01-01 00:00:32 TAI
|
||||
(22s plus the initial 10s offset)[.](#1.sentence-5)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3071)
|
||||
|
||||
tai_clock is not a [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") unless the implementation can guarantee that tai_clock::now() does not propagate an exception[.](#2.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
noexcept(from_utc(utc_clock::now())) is false[.](#2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
220
cppdraft/time/clock/utc.md
Normal file
220
cppdraft/time/clock/utc.md
Normal file
@@ -0,0 +1,220 @@
|
||||
[time.clock.utc]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#utc)
|
||||
|
||||
### 30.7.3 Class utc_clock [time.clock.utc]
|
||||
|
||||
#### [30.7.3.1](#overview) Overview [[time.clock.utc.overview]](time.clock.utc.overview)
|
||||
|
||||
namespace std::chrono {class utc_clock {public:using rep = *a signed arithmetic type*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<utc_clock>; static constexpr bool is_steady = *unspecified*; static time_point now(); template<class Duration>static sys_time<common_type_t<Duration, seconds>> to_sys(const utc_time<Duration>& t); template<class Duration>static utc_time<common_type_t<Duration, seconds>> from_sys(const sys_time<Duration>& t); };}
|
||||
|
||||
[1](#overview-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2834)
|
||||
|
||||
In contrast to sys_time,
|
||||
which does not take leap seconds into account,utc_clock and its associated time_point, utc_time,
|
||||
count time, including leap seconds, since 1970-01-01 00:00:00 UTC.
|
||||
|
||||
[*Note [1](#overview-note-1)*:
|
||||
|
||||
The UTC time standard began on 1972-01-01 00:00:10 TAI.
|
||||
To measure time since this epoch instead, one can add/subtract the constantsys_days{1972y/1/1} - sys_days{1970y/1/1} (63'072'000s)
|
||||
from the utc_time[.](#overview-1.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#overview-example-1)*:
|
||||
|
||||
|
||||
clock_cast<utc_clock>(sys_seconds{sys_days{1970y/January/1}}).time_since_epoch() is 0s[.](#overview-1.sentence-2)
|
||||
|
||||
|
||||
|
||||
|
||||
clock_cast<utc_clock>(sys_seconds{sys_days{2000y/January/1}}).time_since_epoch() is 946'684'822s,
|
||||
|
||||
which is 10'957 * 86'400s + 22s[.](#overview-1.sentence-4)
|
||||
|
||||
|
||||
â *end example*]
|
||||
|
||||
[2](#overview-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2852)
|
||||
|
||||
utc_clock is not a [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") unless the implementation can guarantee that utc_clock::now() does not propagate an exception[.](#overview-2.sentence-1)
|
||||
|
||||
[*Note [2](#overview-note-2)*:
|
||||
|
||||
noexcept(from_sys(system_clock::now())) is false[.](#overview-2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [30.7.3.2](#members) Member functions [[time.clock.utc.members]](time.clock.utc.members)
|
||||
|
||||
[ð](#lib:now,utc_clock)
|
||||
|
||||
`static time_point now();
|
||||
`
|
||||
|
||||
[1](#members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2868)
|
||||
|
||||
*Returns*: from_sys(system_clock::now()), or a more accurate value of utc_time[.](#members-1.sentence-1)
|
||||
|
||||
[ð](#lib:to_sys,utc_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static sys_time<common_type_t<Duration, seconds>>
|
||||
to_sys(const utc_time<Duration>& u);
|
||||
`
|
||||
|
||||
[2](#members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2881)
|
||||
|
||||
*Returns*: A sys_time t,
|
||||
such that from_sys(t) == u if such a mapping exists[.](#members-2.sentence-1)
|
||||
|
||||
Otherwise u represents a time_point during a positive leap second insertion,
|
||||
the conversion counts that leap second as not inserted,
|
||||
and the last representable value of sys_time prior to the insertion of the leap second is returned[.](#members-2.sentence-2)
|
||||
|
||||
[ð](#lib:from_sys,utc_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static utc_time<common_type_t<Duration, seconds>>
|
||||
from_sys(const sys_time<Duration>& t);
|
||||
`
|
||||
|
||||
[3](#members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2900)
|
||||
|
||||
*Returns*: A utc_time u, such thatu.time_since_epoch() - t.time_since_epoch() is equal to the sum of leap seconds that were inserted
|
||||
between t and 1970-01-01[.](#members-3.sentence-1)
|
||||
|
||||
If t is exactly the date of leap second insertion,
|
||||
then the conversion counts that leap second as inserted[.](#members-3.sentence-2)
|
||||
|
||||
[*Example [1](#members-example-1)*: auto t = sys_days{July/1/2015} - 2ns;auto u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 25s);
|
||||
t += 1ns;
|
||||
u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 25s);
|
||||
t += 1ns;
|
||||
u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 26s);
|
||||
t += 1ns;
|
||||
u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 26s); â *end example*]
|
||||
|
||||
#### [30.7.3.3](#nonmembers) Non-member functions [[time.clock.utc.nonmembers]](time.clock.utc.nonmembers)
|
||||
|
||||
[ð](#lib:operator%3c%3c,utc_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const utc_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2937)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[2](#nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2944)
|
||||
|
||||
[*Example [1](#nonmembers-example-1)*: auto t = sys_days{July/1/2015} - 500ms;auto u = clock_cast<utc_clock>(t);for (auto i = 0; i < 8; ++i, u += 250ms) cout << u << " UTC\n";
|
||||
|
||||
Produces this output:
|
||||
|
||||
```
|
||||
2015-06-30 23:59:59.500 UTC
|
||||
2015-06-30 23:59:59.750 UTC
|
||||
2015-06-30 23:59:60.000 UTC
|
||||
2015-06-30 23:59:60.250 UTC
|
||||
2015-06-30 23:59:60.500 UTC
|
||||
2015-06-30 23:59:60.750 UTC
|
||||
2015-07-01 00:00:00.000 UTC
|
||||
2015-07-01 00:00:00.250 UTC
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:from_stream,utc_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
utc_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[3](#nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2977)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the utc_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#nonmembers-3.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#nonmembers-3.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#nonmembers-3.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#nonmembers-3.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp
|
||||
prior to assigning that difference to tp[.](#nonmembers-3.sentence-5)
|
||||
|
||||
[4](#nonmembers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2994)
|
||||
|
||||
*Returns*: is[.](#nonmembers-4.sentence-1)
|
||||
|
||||
[ð](#lib:leap_second_info)
|
||||
|
||||
`struct leap_second_info {
|
||||
bool is_leap_second;
|
||||
seconds elapsed;
|
||||
};
|
||||
`
|
||||
|
||||
[5](#nonmembers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3008)
|
||||
|
||||
The type leap_second_info has data members and special members specified above[.](#nonmembers-5.sentence-1)
|
||||
|
||||
It has no base classes or members other than those specified[.](#nonmembers-5.sentence-2)
|
||||
|
||||
[ð](#lib:get_leap_second_info)
|
||||
|
||||
`template<class Duration>
|
||||
leap_second_info get_leap_second_info(const utc_time<Duration>& ut);
|
||||
`
|
||||
|
||||
[6](#nonmembers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3021)
|
||||
|
||||
*Returns*: A leap_second_info lsi,
|
||||
where lsi.is_leap_second is true if ut is during a positive leap second insertion, and
|
||||
otherwise false[.](#nonmembers-6.sentence-1)
|
||||
|
||||
lsi.elapsed is the sum of leap seconds between 1970-01-01 and ut[.](#nonmembers-6.sentence-2)
|
||||
|
||||
If lsi.is_leap_second is true,
|
||||
the leap second referred to by ut is included in the sum[.](#nonmembers-6.sentence-3)
|
||||
67
cppdraft/time/clock/utc/members.md
Normal file
67
cppdraft/time/clock/utc/members.md
Normal file
@@ -0,0 +1,67 @@
|
||||
[time.clock.utc.members]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#utc.members)
|
||||
|
||||
### 30.7.3 Class utc_clock [[time.clock.utc]](time.clock.utc#members)
|
||||
|
||||
#### 30.7.3.2 Member functions [time.clock.utc.members]
|
||||
|
||||
[ð](#lib:now,utc_clock)
|
||||
|
||||
`static time_point now();
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2868)
|
||||
|
||||
*Returns*: from_sys(system_clock::now()), or a more accurate value of utc_time[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:to_sys,utc_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static sys_time<common_type_t<Duration, seconds>>
|
||||
to_sys(const utc_time<Duration>& u);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2881)
|
||||
|
||||
*Returns*: A sys_time t,
|
||||
such that from_sys(t) == u if such a mapping exists[.](#2.sentence-1)
|
||||
|
||||
Otherwise u represents a time_point during a positive leap second insertion,
|
||||
the conversion counts that leap second as not inserted,
|
||||
and the last representable value of sys_time prior to the insertion of the leap second is returned[.](#2.sentence-2)
|
||||
|
||||
[ð](#lib:from_sys,utc_clock)
|
||||
|
||||
`template<class Duration>
|
||||
static utc_time<common_type_t<Duration, seconds>>
|
||||
from_sys(const sys_time<Duration>& t);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2900)
|
||||
|
||||
*Returns*: A utc_time u, such thatu.time_since_epoch() - t.time_since_epoch() is equal to the sum of leap seconds that were inserted
|
||||
between t and 1970-01-01[.](#3.sentence-1)
|
||||
|
||||
If t is exactly the date of leap second insertion,
|
||||
then the conversion counts that leap second as inserted[.](#3.sentence-2)
|
||||
|
||||
[*Example [1](#example-1)*: auto t = sys_days{July/1/2015} - 2ns;auto u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 25s);
|
||||
t += 1ns;
|
||||
u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 25s);
|
||||
t += 1ns;
|
||||
u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 26s);
|
||||
t += 1ns;
|
||||
u = utc_clock::from_sys(t);
|
||||
assert(u.time_since_epoch() - t.time_since_epoch() == 26s); â *end example*]
|
||||
113
cppdraft/time/clock/utc/nonmembers.md
Normal file
113
cppdraft/time/clock/utc/nonmembers.md
Normal file
@@ -0,0 +1,113 @@
|
||||
[time.clock.utc.nonmembers]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#utc.nonmembers)
|
||||
|
||||
### 30.7.3 Class utc_clock [[time.clock.utc]](time.clock.utc#nonmembers)
|
||||
|
||||
#### 30.7.3.3 Non-member functions [time.clock.utc.nonmembers]
|
||||
|
||||
[ð](#lib:operator%3c%3c,utc_time)
|
||||
|
||||
`template<class charT, class traits, class Duration>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const utc_time<Duration>& t);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2937)
|
||||
|
||||
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), t);
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2944)
|
||||
|
||||
[*Example [1](#example-1)*: auto t = sys_days{July/1/2015} - 500ms;auto u = clock_cast<utc_clock>(t);for (auto i = 0; i < 8; ++i, u += 250ms) cout << u << " UTC\n";
|
||||
|
||||
Produces this output:
|
||||
|
||||
```
|
||||
2015-06-30 23:59:59.500 UTC
|
||||
2015-06-30 23:59:59.750 UTC
|
||||
2015-06-30 23:59:60.000 UTC
|
||||
2015-06-30 23:59:60.250 UTC
|
||||
2015-06-30 23:59:60.500 UTC
|
||||
2015-06-30 23:59:60.750 UTC
|
||||
2015-07-01 00:00:00.000 UTC
|
||||
2015-07-01 00:00:00.250 UTC
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:from_stream,utc_time)
|
||||
|
||||
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
utc_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2977)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the utc_time tp using
|
||||
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#3.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#3.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#3.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#3.sentence-4)
|
||||
|
||||
Additionally, the parsed offset will be subtracted from
|
||||
the successfully parsed timestamp
|
||||
prior to assigning that difference to tp[.](#3.sentence-5)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2994)
|
||||
|
||||
*Returns*: is[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:leap_second_info)
|
||||
|
||||
`struct leap_second_info {
|
||||
bool is_leap_second;
|
||||
seconds elapsed;
|
||||
};
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3008)
|
||||
|
||||
The type leap_second_info has data members and special members specified above[.](#5.sentence-1)
|
||||
|
||||
It has no base classes or members other than those specified[.](#5.sentence-2)
|
||||
|
||||
[ð](#lib:get_leap_second_info)
|
||||
|
||||
`template<class Duration>
|
||||
leap_second_info get_leap_second_info(const utc_time<Duration>& ut);
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3021)
|
||||
|
||||
*Returns*: A leap_second_info lsi,
|
||||
where lsi.is_leap_second is true if ut is during a positive leap second insertion, and
|
||||
otherwise false[.](#6.sentence-1)
|
||||
|
||||
lsi.elapsed is the sum of leap seconds between 1970-01-01 and ut[.](#6.sentence-2)
|
||||
|
||||
If lsi.is_leap_second is true,
|
||||
the leap second referred to by ut is included in the sum[.](#6.sentence-3)
|
||||
54
cppdraft/time/clock/utc/overview.md
Normal file
54
cppdraft/time/clock/utc/overview.md
Normal file
@@ -0,0 +1,54 @@
|
||||
[time.clock.utc.overview]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.7 Clocks [[time.clock]](time.clock#utc.overview)
|
||||
|
||||
### 30.7.3 Class utc_clock [[time.clock.utc]](time.clock.utc#overview)
|
||||
|
||||
#### 30.7.3.1 Overview [time.clock.utc.overview]
|
||||
|
||||
namespace std::chrono {class utc_clock {public:using rep = *a signed arithmetic type*; using period = ratio<*unspecified*, *unspecified*>; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<utc_clock>; static constexpr bool is_steady = *unspecified*; static time_point now(); template<class Duration>static sys_time<common_type_t<Duration, seconds>> to_sys(const utc_time<Duration>& t); template<class Duration>static utc_time<common_type_t<Duration, seconds>> from_sys(const sys_time<Duration>& t); };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2834)
|
||||
|
||||
In contrast to sys_time,
|
||||
which does not take leap seconds into account,utc_clock and its associated time_point, utc_time,
|
||||
count time, including leap seconds, since 1970-01-01 00:00:00 UTC.
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The UTC time standard began on 1972-01-01 00:00:10 TAI.
|
||||
To measure time since this epoch instead, one can add/subtract the constantsys_days{1972y/1/1} - sys_days{1970y/1/1} (63'072'000s)
|
||||
from the utc_time[.](#1.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
|
||||
clock_cast<utc_clock>(sys_seconds{sys_days{1970y/January/1}}).time_since_epoch() is 0s[.](#1.sentence-2)
|
||||
|
||||
|
||||
|
||||
|
||||
clock_cast<utc_clock>(sys_seconds{sys_days{2000y/January/1}}).time_since_epoch() is 946'684'822s,
|
||||
|
||||
which is 10'957 * 86'400s + 22s[.](#1.sentence-4)
|
||||
|
||||
|
||||
â *end example*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2852)
|
||||
|
||||
utc_clock is not a [*Cpp17TrivialClock*](time.clock.req#:Cpp17TrivialClock "30.3 Cpp17Clock requirements [time.clock.req]") unless the implementation can guarantee that utc_clock::now() does not propagate an exception[.](#2.sentence-1)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
noexcept(from_sys(system_clock::now())) is false[.](#2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
986
cppdraft/time/duration.md
Normal file
986
cppdraft/time/duration.md
Normal file
@@ -0,0 +1,986 @@
|
||||
[time.duration]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.5 Class template duration [time.duration]
|
||||
|
||||
### [30.5.1](#general) General [[time.duration.general]](time.duration.general)
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1238)
|
||||
|
||||
A duration type measures time between two points in time (time_points)[.](#general-1.sentence-1)
|
||||
|
||||
A duration has a representation which holds a count of ticks and a tick period[.](#general-1.sentence-2)
|
||||
|
||||
The tick period is the amount of time which occurs from one tick to the next, in units
|
||||
of seconds[.](#general-1.sentence-3)
|
||||
|
||||
It is expressed as a rational constant using the template ratio[.](#general-1.sentence-4)
|
||||
|
||||
[ð](#lib:duration)
|
||||
|
||||
namespace std::chrono {template<class Rep, class Period = ratio<1>>class duration {public:using rep = Rep; using period = typename Period::type; private: rep rep_; // *exposition only*public:// [[time.duration.cons]](#cons "30.5.2 Constructors"), construct/copy/destroyconstexpr duration() = default; template<class Rep2>constexpr explicit duration(const Rep2& r); template<class Rep2, class Period2>constexpr duration(const duration<Rep2, Period2>& d); ~duration() = default;
|
||||
duration(const duration&) = default;
|
||||
duration& operator=(const duration&) = default; // [[time.duration.observer]](#observer "30.5.3 Observer"), observerconstexpr rep count() const; // [[time.duration.arithmetic]](#arithmetic "30.5.4 Arithmetic"), arithmeticconstexpr common_type_t<duration> operator+() const; constexpr common_type_t<duration> operator-() const; constexpr duration& operator++(); constexpr duration operator++(int); constexpr duration& operator--(); constexpr duration operator--(int); constexpr duration& operator+=(const duration& d); constexpr duration& operator-=(const duration& d); constexpr duration& operator*=(const rep& rhs); constexpr duration& operator/=(const rep& rhs); constexpr duration& operator%=(const rep& rhs); constexpr duration& operator%=(const duration& rhs); // [[time.duration.special]](#special "30.5.5 Special values"), special valuesstatic constexpr duration zero() noexcept; static constexpr duration min() noexcept; static constexpr duration max() noexcept; };}
|
||||
|
||||
[2](#general-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1294)
|
||||
|
||||
Rep shall be an arithmetic type or a class emulating an arithmetic type[.](#general-2.sentence-1)
|
||||
|
||||
If duration is instantiated with a duration type as the argument for the template
|
||||
parameter Rep, the program is ill-formed[.](#general-2.sentence-2)
|
||||
|
||||
[3](#general-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1299)
|
||||
|
||||
If Period is not a specialization of ratio, the program is ill-formed[.](#general-3.sentence-1)
|
||||
|
||||
If Period::num is not positive, the program is ill-formed[.](#general-3.sentence-2)
|
||||
|
||||
[4](#general-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1303)
|
||||
|
||||
Members of duration do not throw exceptions other than
|
||||
those thrown by the indicated operations on their representations[.](#general-4.sentence-1)
|
||||
|
||||
[5](#general-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1307)
|
||||
|
||||
The defaulted copy constructor of duration shall be a
|
||||
constexpr function if and only if the required initialization
|
||||
of the member rep_ for copy and move, respectively, would
|
||||
be constexpr-suitable ([[dcl.constexpr]](dcl.constexpr "9.2.6 The constexpr and consteval specifiers"))[.](#general-5.sentence-1)
|
||||
|
||||
[6](#general-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1313)
|
||||
|
||||
[*Example [1](#general-example-1)*: duration<long, ratio<60>> d0; // holds a count of minutes using a long duration<long long, milli> d1; // holds a count of milliseconds using a long long duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 130 of a second// (30 Hz) using a double â *end example*]
|
||||
|
||||
### [30.5.2](#cons) Constructors [[time.duration.cons]](time.duration.cons)
|
||||
|
||||
[ð](#lib:duration,constructor)
|
||||
|
||||
`template<class Rep2>
|
||||
constexpr explicit duration(const Rep2& r);
|
||||
`
|
||||
|
||||
[1](#cons-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1332)
|
||||
|
||||
*Constraints*: is_convertible_v<const Rep2&, rep> is true and
|
||||
|
||||
- [(1.1)](#cons-1.1)
|
||||
|
||||
treat_as_floating_point_v<rep> is true or
|
||||
|
||||
- [(1.2)](#cons-1.2)
|
||||
|
||||
treat_as_floating_point_v<Rep2> is false[.](#cons-1.sentence-1)
|
||||
|
||||
[*Example [1](#cons-example-1)*: duration<int, milli> d(3); // OK duration<int, milli> d2(3.5); // error â *end example*]
|
||||
|
||||
[2](#cons-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1346)
|
||||
|
||||
*Effects*: Initializes rep_ with r[.](#cons-2.sentence-1)
|
||||
|
||||
[ð](#lib:duration,constructor_)
|
||||
|
||||
`template<class Rep2, class Period2>
|
||||
constexpr duration(const duration<Rep2, Period2>& d);
|
||||
`
|
||||
|
||||
[3](#cons-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1358)
|
||||
|
||||
*Constraints*: No overflow is induced in the conversion andtreat_as_floating_point_v<rep> is true or bothratio_divide<Period2, period>::den is 1 andtreat_as_floating_point_v<Rep2> is false[.](#cons-3.sentence-1)
|
||||
|
||||
[*Note [1](#cons-note-1)*:
|
||||
|
||||
This
|
||||
requirement prevents implicit truncation error when converting between
|
||||
integral-based duration types[.](#cons-3.sentence-2)
|
||||
|
||||
Such a construction could easily lead to
|
||||
confusion about the value of the duration[.](#cons-3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [2](#cons-example-2)*: duration<int, milli> ms(3);
|
||||
duration<int, micro> us = ms; // OK duration<int, milli> ms2 = us; // error â *end example*]
|
||||
|
||||
[4](#cons-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1378)
|
||||
|
||||
*Effects*: Initializes rep_ with duration_cast<duration>(d).count()[.](#cons-4.sentence-1)
|
||||
|
||||
### [30.5.3](#observer) Observer [[time.duration.observer]](time.duration.observer)
|
||||
|
||||
[ð](#lib:count,duration)
|
||||
|
||||
`constexpr rep count() const;
|
||||
`
|
||||
|
||||
[1](#observer-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1391)
|
||||
|
||||
*Returns*: rep_[.](#observer-1.sentence-1)
|
||||
|
||||
### [30.5.4](#arithmetic) Arithmetic [[time.duration.arithmetic]](time.duration.arithmetic)
|
||||
|
||||
[ð](#lib:operator+,duration)
|
||||
|
||||
`constexpr common_type_t<duration> operator+() const;
|
||||
`
|
||||
|
||||
[1](#arithmetic-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1404)
|
||||
|
||||
*Returns*: common_type_t<duration>(*this)[.](#arithmetic-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,duration)
|
||||
|
||||
`constexpr common_type_t<duration> operator-() const;
|
||||
`
|
||||
|
||||
[2](#arithmetic-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1415)
|
||||
|
||||
*Returns*: common_type_t<duration>(-rep_)[.](#arithmetic-2.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,duration)
|
||||
|
||||
`constexpr duration& operator++();
|
||||
`
|
||||
|
||||
[3](#arithmetic-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1426)
|
||||
|
||||
*Effects*: Equivalent to: ++rep_[.](#arithmetic-3.sentence-1)
|
||||
|
||||
[4](#arithmetic-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1430)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-4.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,duration_)
|
||||
|
||||
`constexpr duration operator++(int);
|
||||
`
|
||||
|
||||
[5](#arithmetic-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1441)
|
||||
|
||||
*Effects*: Equivalent to: return duration(rep_++);
|
||||
|
||||
[ð](#lib:operator--,duration)
|
||||
|
||||
`constexpr duration& operator--();
|
||||
`
|
||||
|
||||
[6](#arithmetic-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1452)
|
||||
|
||||
*Effects*: Equivalent to: --rep_[.](#arithmetic-6.sentence-1)
|
||||
|
||||
[7](#arithmetic-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1456)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,duration_)
|
||||
|
||||
`constexpr duration operator--(int);
|
||||
`
|
||||
|
||||
[8](#arithmetic-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1467)
|
||||
|
||||
*Effects*: Equivalent to: return duration(rep_--);
|
||||
|
||||
[ð](#lib:operator+=,duration)
|
||||
|
||||
`constexpr duration& operator+=(const duration& d);
|
||||
`
|
||||
|
||||
[9](#arithmetic-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1478)
|
||||
|
||||
*Effects*: Equivalent to: rep_ += d.count()[.](#arithmetic-9.sentence-1)
|
||||
|
||||
[10](#arithmetic-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1482)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-10.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,duration)
|
||||
|
||||
`constexpr duration& operator-=(const duration& d);
|
||||
`
|
||||
|
||||
[11](#arithmetic-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1493)
|
||||
|
||||
*Effects*: Equivalent to: rep_ -= d.count()[.](#arithmetic-11.sentence-1)
|
||||
|
||||
[12](#arithmetic-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1497)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-12.sentence-1)
|
||||
|
||||
[ð](#lib:operator*=,duration)
|
||||
|
||||
`constexpr duration& operator*=(const rep& rhs);
|
||||
`
|
||||
|
||||
[13](#arithmetic-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1508)
|
||||
|
||||
*Effects*: Equivalent to: rep_ *= rhs[.](#arithmetic-13.sentence-1)
|
||||
|
||||
[14](#arithmetic-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1512)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-14.sentence-1)
|
||||
|
||||
[ð](#lib:operator/=,duration)
|
||||
|
||||
`constexpr duration& operator/=(const rep& rhs);
|
||||
`
|
||||
|
||||
[15](#arithmetic-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1523)
|
||||
|
||||
*Effects*: Equivalent to: rep_ /= rhs[.](#arithmetic-15.sentence-1)
|
||||
|
||||
[16](#arithmetic-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1527)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-16.sentence-1)
|
||||
|
||||
[ð](#lib:operator%25=,duration)
|
||||
|
||||
`constexpr duration& operator%=(const rep& rhs);
|
||||
`
|
||||
|
||||
[17](#arithmetic-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1538)
|
||||
|
||||
*Effects*: Equivalent to: rep_ %= rhs[.](#arithmetic-17.sentence-1)
|
||||
|
||||
[18](#arithmetic-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1542)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-18.sentence-1)
|
||||
|
||||
[ð](#lib:operator%25=,duration_)
|
||||
|
||||
`constexpr duration& operator%=(const duration& rhs);
|
||||
`
|
||||
|
||||
[19](#arithmetic-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1553)
|
||||
|
||||
*Effects*: Equivalent to: rep_ %= rhs.count()[.](#arithmetic-19.sentence-1)
|
||||
|
||||
[20](#arithmetic-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1557)
|
||||
|
||||
*Returns*: *this[.](#arithmetic-20.sentence-1)
|
||||
|
||||
### [30.5.5](#special) Special values [[time.duration.special]](time.duration.special)
|
||||
|
||||
[ð](#lib:zero,duration)
|
||||
|
||||
`static constexpr duration zero() noexcept;
|
||||
`
|
||||
|
||||
[1](#special-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1571)
|
||||
|
||||
*Returns*: duration(duration_values<rep>::zero())[.](#special-1.sentence-1)
|
||||
|
||||
[ð](#lib:min,duration)
|
||||
|
||||
`static constexpr duration min() noexcept;
|
||||
`
|
||||
|
||||
[2](#special-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1582)
|
||||
|
||||
*Returns*: duration(duration_values<rep>::min())[.](#special-2.sentence-1)
|
||||
|
||||
[ð](#lib:max,duration)
|
||||
|
||||
`static constexpr duration max() noexcept;
|
||||
`
|
||||
|
||||
[3](#special-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1593)
|
||||
|
||||
*Returns*: duration(duration_values<rep>::max())[.](#special-3.sentence-1)
|
||||
|
||||
### [30.5.6](#nonmember) Non-member arithmetic [[time.duration.nonmember]](time.duration.nonmember)
|
||||
|
||||
[1](#nonmember-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1600)
|
||||
|
||||
In the function descriptions that follow, unless stated otherwise,
|
||||
let CD represent the return type of the function[.](#nonmember-1.sentence-1)
|
||||
|
||||
[ð](#lib:operator+,duration_)
|
||||
|
||||
`template<class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
|
||||
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
`
|
||||
|
||||
[2](#nonmember-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1612)
|
||||
|
||||
*Returns*: CD(CD(lhs).count() + CD(rhs).count())[.](#nonmember-2.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,duration_)
|
||||
|
||||
`template<class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
|
||||
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
`
|
||||
|
||||
[3](#nonmember-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1625)
|
||||
|
||||
*Returns*: CD(CD(lhs).count() - CD(rhs).count())[.](#nonmember-3.sentence-1)
|
||||
|
||||
[ð](#lib:operator*,duration)
|
||||
|
||||
`template<class Rep1, class Period, class Rep2>
|
||||
constexpr duration<common_type_t<Rep1, Rep2>, Period>
|
||||
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
`
|
||||
|
||||
[4](#nonmember-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1638)
|
||||
|
||||
*Constraints*: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true[.](#nonmember-4.sentence-1)
|
||||
|
||||
[5](#nonmember-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1642)
|
||||
|
||||
*Returns*: CD(CD(d).count() * s)[.](#nonmember-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator*,duration_)
|
||||
|
||||
`template<class Rep1, class Rep2, class Period>
|
||||
constexpr duration<common_type_t<Rep1, Rep2>, Period>
|
||||
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
||||
`
|
||||
|
||||
[6](#nonmember-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1655)
|
||||
|
||||
*Constraints*: is_convertible_v<const Rep1&, common_type_t<Rep1, Rep2>> is true[.](#nonmember-6.sentence-1)
|
||||
|
||||
[7](#nonmember-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1659)
|
||||
|
||||
*Returns*: d * s[.](#nonmember-7.sentence-1)
|
||||
|
||||
[ð](#lib:operator/,duration)
|
||||
|
||||
`template<class Rep1, class Period, class Rep2>
|
||||
constexpr duration<common_type_t<Rep1, Rep2>, Period>
|
||||
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
`
|
||||
|
||||
[8](#nonmember-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1672)
|
||||
|
||||
*Constraints*: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true and Rep2 is not a specialization of duration[.](#nonmember-8.sentence-1)
|
||||
|
||||
[9](#nonmember-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1677)
|
||||
|
||||
*Returns*: CD(CD(d).count() / s)[.](#nonmember-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator/,duration_)
|
||||
|
||||
`template<class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr common_type_t<Rep1, Rep2>
|
||||
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
`
|
||||
|
||||
[10](#nonmember-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1690)
|
||||
|
||||
Let CD becommon_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>[.](#nonmember-10.sentence-1)
|
||||
|
||||
[11](#nonmember-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1694)
|
||||
|
||||
*Returns*: CD(lhs).count() / CD(rhs).count()[.](#nonmember-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator%25,duration)
|
||||
|
||||
`template<class Rep1, class Period, class Rep2>
|
||||
constexpr duration<common_type_t<Rep1, Rep2>, Period>
|
||||
operator%(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
`
|
||||
|
||||
[12](#nonmember-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1707)
|
||||
|
||||
*Constraints*: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true andRep2 is not a specialization of duration[.](#nonmember-12.sentence-1)
|
||||
|
||||
[13](#nonmember-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1712)
|
||||
|
||||
*Returns*: CD(CD(d).count() % s)[.](#nonmember-13.sentence-1)
|
||||
|
||||
[ð](#lib:operator%25,duration_)
|
||||
|
||||
`template<class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
|
||||
operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
`
|
||||
|
||||
[14](#nonmember-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1725)
|
||||
|
||||
*Returns*: CD(CD(lhs).count() % CD(rhs).count())[.](#nonmember-14.sentence-1)
|
||||
|
||||
### [30.5.7](#comparisons) Comparisons [[time.duration.comparisons]](time.duration.comparisons)
|
||||
|
||||
[1](#comparisons-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[.](#comparisons-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](#comparisons-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1746)
|
||||
|
||||
*Returns*: CT(lhs).count() == CT(rhs).count()[.](#comparisons-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](#comparisons-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1759)
|
||||
|
||||
*Returns*: CT(lhs).count() < CT(rhs).count()[.](#comparisons-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](#comparisons-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1772)
|
||||
|
||||
*Returns*: rhs < lhs[.](#comparisons-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](#comparisons-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1785)
|
||||
|
||||
*Returns*: !(rhs < lhs)[.](#comparisons-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](#comparisons-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1798)
|
||||
|
||||
*Returns*: !(lhs < rhs)[.](#comparisons-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](#comparisons-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1812)
|
||||
|
||||
*Returns*: CT(lhs).count() <=> CT(rhs).count()[.](#comparisons-7.sentence-1)
|
||||
|
||||
### [30.5.8](#cast) Conversions [[time.duration.cast]](time.duration.cast)
|
||||
|
||||
[ð](#lib:duration,duration_cast)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[1](#cast-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1827)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration[.](#cast-1.sentence-1)
|
||||
|
||||
[2](#cast-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1831)
|
||||
|
||||
*Returns*: Let CF be ratio_divide<Period, typename ToDuration::period>, and CR be common_type<typename ToDuration::rep, Rep, intmax_t>::type[.](#cast-2.sentence-1)
|
||||
|
||||
- [(2.1)](#cast-2.1)
|
||||
|
||||
If CF::num == 1 and CF::den == 1, returnsToDuration(static_cast<typename ToDuration::rep>(d.count()))
|
||||
|
||||
- [(2.2)](#cast-2.2)
|
||||
|
||||
otherwise, if CF::num != 1 and CF::den == 1, returnsToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) * static_cast<CR>(CF::num)))
|
||||
|
||||
- [(2.3)](#cast-2.3)
|
||||
|
||||
otherwise, if CF::num == 1 and CF::den != 1, returnsToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) / static_cast<CR>(CF::den)))
|
||||
|
||||
- [(2.4)](#cast-2.4)
|
||||
|
||||
otherwise, returnsToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) * static_cast<CR>(CF::num) / static_cast<CR>(CF::den)))
|
||||
|
||||
[3](#cast-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1861)
|
||||
|
||||
[*Note [1](#cast-note-1)*:
|
||||
|
||||
This function does not use any implicit conversions; all conversions
|
||||
are done with static_cast[.](#cast-3.sentence-1)
|
||||
|
||||
It avoids multiplications and divisions when
|
||||
it is known at compile time that one or more arguments is 1[.](#cast-3.sentence-2)
|
||||
|
||||
Intermediate
|
||||
computations are carried out in the widest representation and only converted to
|
||||
the destination representation at the final step[.](#cast-3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:floor,duration)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration floor(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[4](#cast-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1878)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration[.](#cast-4.sentence-1)
|
||||
|
||||
[5](#cast-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1882)
|
||||
|
||||
*Returns*: The greatest result t representable in ToDuration for which t <= d[.](#cast-5.sentence-1)
|
||||
|
||||
[ð](#lib:ceil,duration)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration ceil(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[6](#cast-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1895)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration[.](#cast-6.sentence-1)
|
||||
|
||||
[7](#cast-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1899)
|
||||
|
||||
*Returns*: The least result t representable in ToDuration for which t >= d[.](#cast-7.sentence-1)
|
||||
|
||||
[ð](#lib:round,duration)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration round(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[8](#cast-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1912)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration andtreat_as_floating_point_v<typename ToDuration::rep> is false[.](#cast-8.sentence-1)
|
||||
|
||||
[9](#cast-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1917)
|
||||
|
||||
*Returns*: The value of ToDuration that is closest to d[.](#cast-9.sentence-1)
|
||||
|
||||
If there are two closest values, then return the value t for which t % 2 == 0[.](#cast-9.sentence-2)
|
||||
|
||||
### [30.5.9](#literals) Suffixes for duration literals [[time.duration.literals]](time.duration.literals)
|
||||
|
||||
[1](#literals-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1926)
|
||||
|
||||
This subclause describes literal suffixes for constructing duration literals[.](#literals-1.sentence-1)
|
||||
|
||||
The
|
||||
suffixes h, min, s, ms, us, ns denote duration values of the corresponding types hours, minutes,seconds, milliseconds, microseconds, and nanoseconds respectively if they are applied to [*integer-literal*](lex.icon#nt:integer-literal "5.13.2 Integer literals [lex.icon]")*s*[.](#literals-1.sentence-2)
|
||||
|
||||
[2](#literals-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1933)
|
||||
|
||||
If any of these suffixes are applied to a [*floating-point-literal*](lex.fcon#nt:floating-point-literal "5.13.4 Floating-point literals [lex.fcon]") the result is achrono::duration literal with an unspecified floating-point representation[.](#literals-2.sentence-1)
|
||||
|
||||
[3](#literals-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1938)
|
||||
|
||||
If any of these suffixes are applied to an [*integer-literal*](lex.icon#nt:integer-literal "5.13.2 Integer literals [lex.icon]") and the resultingchrono::duration value cannot be represented in the result type because
|
||||
of overflow, the program is ill-formed[.](#literals-3.sentence-1)
|
||||
|
||||
[4](#literals-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1944)
|
||||
|
||||
[*Example [1](#literals-example-1)*:
|
||||
|
||||
The following code shows some duration literals[.](#literals-4.sentence-1)
|
||||
|
||||
using namespace std::chrono_literals;auto constexpr aday=24h;auto constexpr lesson=45min;auto constexpr halfanhour=0.5h; â *end example*]
|
||||
|
||||
[ð](#lib:operator%22%22h,duration)
|
||||
|
||||
`constexpr chrono::hours operator""h(unsigned long long hours);
|
||||
constexpr chrono::duration<unspecified, ratio<3600, 1>> operator""h(long double hours);
|
||||
`
|
||||
|
||||
[5](#literals-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1962)
|
||||
|
||||
*Returns*: A duration literal representing hours hours[.](#literals-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22min,duration)
|
||||
|
||||
`constexpr chrono::minutes operator""min(unsigned long long minutes);
|
||||
constexpr chrono::duration<unspecified, ratio<60, 1>> operator""min(long double minutes);
|
||||
`
|
||||
|
||||
[6](#literals-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1974)
|
||||
|
||||
*Returns*: A duration literal representing minutes minutes[.](#literals-6.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22s,duration)
|
||||
|
||||
`constexpr chrono::seconds operator""s(unsigned long long sec);
|
||||
constexpr chrono::duration<unspecified> operator""s(long double sec);
|
||||
`
|
||||
|
||||
[7](#literals-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1986)
|
||||
|
||||
*Returns*: A duration literal representing sec seconds[.](#literals-7.sentence-1)
|
||||
|
||||
[8](#literals-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1990)
|
||||
|
||||
[*Note [1](#literals-note-1)*:
|
||||
|
||||
The same suffix s is used for basic_string but there is no
|
||||
conflict, since duration suffixes apply to numbers and string literal suffixes
|
||||
apply to character array literals[.](#literals-8.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator%22%22ms,duration)
|
||||
|
||||
`constexpr chrono::milliseconds operator""ms(unsigned long long msec);
|
||||
constexpr chrono::duration<unspecified, milli> operator""ms(long double msec);
|
||||
`
|
||||
|
||||
[9](#literals-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2005)
|
||||
|
||||
*Returns*: A duration literal representing msec milliseconds[.](#literals-9.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22us,duration)
|
||||
|
||||
`constexpr chrono::microseconds operator""us(unsigned long long usec);
|
||||
constexpr chrono::duration<unspecified, micro> operator""us(long double usec);
|
||||
`
|
||||
|
||||
[10](#literals-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2017)
|
||||
|
||||
*Returns*: A duration literal representing usec microseconds[.](#literals-10.sentence-1)
|
||||
|
||||
[ð](#lib:operator%22%22ns,duration)
|
||||
|
||||
`constexpr chrono::nanoseconds operator""ns(unsigned long long nsec);
|
||||
constexpr chrono::duration<unspecified, nano> operator""ns(long double nsec);
|
||||
`
|
||||
|
||||
[11](#literals-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2029)
|
||||
|
||||
*Returns*: A duration literal representing nsec nanoseconds[.](#literals-11.sentence-1)
|
||||
|
||||
### [30.5.10](#alg) Algorithms [[time.duration.alg]](time.duration.alg)
|
||||
|
||||
[ð](#lib:abs,duration)
|
||||
|
||||
`template<class Rep, class Period>
|
||||
constexpr duration<Rep, Period> abs(duration<Rep, Period> d);
|
||||
`
|
||||
|
||||
[1](#alg-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2043)
|
||||
|
||||
*Constraints*: numeric_limits<Rep>::is_signed is true[.](#alg-1.sentence-1)
|
||||
|
||||
[2](#alg-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2047)
|
||||
|
||||
*Returns*: If d >= d.zero(), return d,
|
||||
otherwise return -d[.](#alg-2.sentence-1)
|
||||
|
||||
### [30.5.11](#io) I/O [[time.duration.io]](time.duration.io)
|
||||
|
||||
[ð](#lib:operator%3c%3c,duration)
|
||||
|
||||
`template<class charT, class traits, class Rep, class Period>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[1](#io-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2063)
|
||||
|
||||
*Effects*: Inserts the duration d onto the stream os as if it were implemented as follows:basic_ostringstream<charT, traits> s;
|
||||
s.flags(os.flags());
|
||||
s.imbue(os.getloc());
|
||||
s.precision(os.precision());
|
||||
s << d.count() << *units-suffix*;return os << s.str(); where *units-suffix* depends on the type Period::type as follows:
|
||||
|
||||
- [(1.1)](#io-1.1)
|
||||
|
||||
If Period::type is atto,*units-suffix* is "as"[.](#io-1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#io-1.2)
|
||||
|
||||
Otherwise, if Period::type is femto,*units-suffix* is "fs"[.](#io-1.2.sentence-1)
|
||||
|
||||
- [(1.3)](#io-1.3)
|
||||
|
||||
Otherwise, if Period::type is pico,*units-suffix* is "ps"[.](#io-1.3.sentence-1)
|
||||
|
||||
- [(1.4)](#io-1.4)
|
||||
|
||||
Otherwise, if Period::type is nano,*units-suffix* is "ns"[.](#io-1.4.sentence-1)
|
||||
|
||||
- [(1.5)](#io-1.5)
|
||||
|
||||
Otherwise, if Period::type is micro,
|
||||
it isimplementation-defined
|
||||
whether *units-suffix* is"μs" ("\u00b5\u0073") or"us"[.](#io-1.5.sentence-1)
|
||||
|
||||
- [(1.6)](#io-1.6)
|
||||
|
||||
Otherwise, if Period::type is milli,*units-suffix* is "ms"[.](#io-1.6.sentence-1)
|
||||
|
||||
- [(1.7)](#io-1.7)
|
||||
|
||||
Otherwise, if Period::type is centi,*units-suffix* is "cs"[.](#io-1.7.sentence-1)
|
||||
|
||||
- [(1.8)](#io-1.8)
|
||||
|
||||
Otherwise, if Period::type is deci,*units-suffix* is "ds"[.](#io-1.8.sentence-1)
|
||||
|
||||
- [(1.9)](#io-1.9)
|
||||
|
||||
Otherwise, if Period::type is ratio<1>,*units-suffix* is "s"[.](#io-1.9.sentence-1)
|
||||
|
||||
- [(1.10)](#io-1.10)
|
||||
|
||||
Otherwise, if Period::type is deca,*units-suffix* is "das"[.](#io-1.10.sentence-1)
|
||||
|
||||
- [(1.11)](#io-1.11)
|
||||
|
||||
Otherwise, if Period::type is hecto,*units-suffix* is "hs"[.](#io-1.11.sentence-1)
|
||||
|
||||
- [(1.12)](#io-1.12)
|
||||
|
||||
Otherwise, if Period::type is kilo,*units-suffix* is "ks"[.](#io-1.12.sentence-1)
|
||||
|
||||
- [(1.13)](#io-1.13)
|
||||
|
||||
Otherwise, if Period::type is mega,*units-suffix* is "Ms"[.](#io-1.13.sentence-1)
|
||||
|
||||
- [(1.14)](#io-1.14)
|
||||
|
||||
Otherwise, if Period::type is giga,*units-suffix* is "Gs"[.](#io-1.14.sentence-1)
|
||||
|
||||
- [(1.15)](#io-1.15)
|
||||
|
||||
Otherwise, if Period::type is tera,*units-suffix* is "Ts"[.](#io-1.15.sentence-1)
|
||||
|
||||
- [(1.16)](#io-1.16)
|
||||
|
||||
Otherwise, if Period::type is peta,*units-suffix* is "Ps"[.](#io-1.16.sentence-1)
|
||||
|
||||
- [(1.17)](#io-1.17)
|
||||
|
||||
Otherwise, if Period::type is exa,*units-suffix* is "Es"[.](#io-1.17.sentence-1)
|
||||
|
||||
- [(1.18)](#io-1.18)
|
||||
|
||||
Otherwise, if Period::type is ratio<60>,*units-suffix* is "min"[.](#io-1.18.sentence-1)
|
||||
|
||||
- [(1.19)](#io-1.19)
|
||||
|
||||
Otherwise, if Period::type is ratio<3600>,*units-suffix* is "h"[.](#io-1.19.sentence-1)
|
||||
|
||||
- [(1.20)](#io-1.20)
|
||||
|
||||
Otherwise, if Period::type is ratio<86400>,*units-suffix* is "d"[.](#io-1.20.sentence-1)
|
||||
|
||||
- [(1.21)](#io-1.21)
|
||||
|
||||
Otherwise, if Period::type::den == 1,*units-suffix* is "[*num*]s"[.](#io-1.21.sentence-1)
|
||||
|
||||
- [(1.22)](#io-1.22)
|
||||
|
||||
Otherwise, *units-suffix* is"[*num*/*den*]s"[.](#io-1.22.sentence-1)
|
||||
|
||||
In the list above,
|
||||
the use of *num* and *den* refers to the static data members of Period::type,
|
||||
which are converted to arrays of charT using a decimal conversion with no leading zeroes[.](#io-1.sentence-2)
|
||||
|
||||
[2](#io-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2176)
|
||||
|
||||
*Returns*: os[.](#io-2.sentence-1)
|
||||
|
||||
[ð](#lib:from_stream,duration)
|
||||
|
||||
`template<class charT, class traits, class Rep, class Period, class Alloc = allocator<charT>>
|
||||
basic_istream<charT, traits>&
|
||||
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
||||
duration<Rep, Period>& d,
|
||||
basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
||||
minutes* offset = nullptr);
|
||||
`
|
||||
|
||||
[3](#io-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2192)
|
||||
|
||||
*Effects*: Attempts to parse the input stream is into the duration d using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#io-3.sentence-1)
|
||||
|
||||
If the parse fails to decode a valid duration,is.setstate(ios_base::failbit) is called and d is not modified[.](#io-3.sentence-2)
|
||||
|
||||
If %Z is used and successfully parsed,
|
||||
that value will be assigned to *abbrev if abbrev is non-null[.](#io-3.sentence-3)
|
||||
|
||||
If %z (or a modified variant) is used and successfully parsed,
|
||||
that value will be assigned to *offset if offset is non-null[.](#io-3.sentence-4)
|
||||
|
||||
[4](#io-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2205)
|
||||
|
||||
*Returns*: is[.](#io-4.sentence-1)
|
||||
26
cppdraft/time/duration/alg.md
Normal file
26
cppdraft/time/duration/alg.md
Normal file
@@ -0,0 +1,26 @@
|
||||
[time.duration.alg]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.5 Class template duration [[time.duration]](time.duration#alg)
|
||||
|
||||
### 30.5.10 Algorithms [time.duration.alg]
|
||||
|
||||
[ð](#lib:abs,duration)
|
||||
|
||||
`template<class Rep, class Period>
|
||||
constexpr duration<Rep, Period> abs(duration<Rep, Period> d);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2043)
|
||||
|
||||
*Constraints*: numeric_limits<Rep>::is_signed is true[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2047)
|
||||
|
||||
*Returns*: If d >= d.zero(), return d,
|
||||
otherwise return -d[.](#2.sentence-1)
|
||||
187
cppdraft/time/duration/arithmetic.md
Normal file
187
cppdraft/time/duration/arithmetic.md
Normal file
@@ -0,0 +1,187 @@
|
||||
[time.duration.arithmetic]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.5 Class template duration [[time.duration]](time.duration#arithmetic)
|
||||
|
||||
### 30.5.4 Arithmetic [time.duration.arithmetic]
|
||||
|
||||
[ð](#lib:operator+,duration)
|
||||
|
||||
`constexpr common_type_t<duration> operator+() const;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1404)
|
||||
|
||||
*Returns*: common_type_t<duration>(*this)[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator-,duration)
|
||||
|
||||
`constexpr common_type_t<duration> operator-() const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1415)
|
||||
|
||||
*Returns*: common_type_t<duration>(-rep_)[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,duration)
|
||||
|
||||
`constexpr duration& operator++();
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1426)
|
||||
|
||||
*Effects*: Equivalent to: ++rep_[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1430)
|
||||
|
||||
*Returns*: *this[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator++,duration_)
|
||||
|
||||
`constexpr duration operator++(int);
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1441)
|
||||
|
||||
*Effects*: Equivalent to: return duration(rep_++);
|
||||
|
||||
[ð](#lib:operator--,duration)
|
||||
|
||||
`constexpr duration& operator--();
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1452)
|
||||
|
||||
*Effects*: Equivalent to: --rep_[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1456)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:operator--,duration_)
|
||||
|
||||
`constexpr duration operator--(int);
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1467)
|
||||
|
||||
*Effects*: Equivalent to: return duration(rep_--);
|
||||
|
||||
[ð](#lib:operator+=,duration)
|
||||
|
||||
`constexpr duration& operator+=(const duration& d);
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1478)
|
||||
|
||||
*Effects*: Equivalent to: rep_ += d.count()[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1482)
|
||||
|
||||
*Returns*: *this[.](#10.sentence-1)
|
||||
|
||||
[ð](#lib:operator-=,duration)
|
||||
|
||||
`constexpr duration& operator-=(const duration& d);
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1493)
|
||||
|
||||
*Effects*: Equivalent to: rep_ -= d.count()[.](#11.sentence-1)
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1497)
|
||||
|
||||
*Returns*: *this[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:operator*=,duration)
|
||||
|
||||
`constexpr duration& operator*=(const rep& rhs);
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1508)
|
||||
|
||||
*Effects*: Equivalent to: rep_ *= rhs[.](#13.sentence-1)
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1512)
|
||||
|
||||
*Returns*: *this[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:operator/=,duration)
|
||||
|
||||
`constexpr duration& operator/=(const rep& rhs);
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1523)
|
||||
|
||||
*Effects*: Equivalent to: rep_ /= rhs[.](#15.sentence-1)
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1527)
|
||||
|
||||
*Returns*: *this[.](#16.sentence-1)
|
||||
|
||||
[ð](#lib:operator%25=,duration)
|
||||
|
||||
`constexpr duration& operator%=(const rep& rhs);
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1538)
|
||||
|
||||
*Effects*: Equivalent to: rep_ %= rhs[.](#17.sentence-1)
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1542)
|
||||
|
||||
*Returns*: *this[.](#18.sentence-1)
|
||||
|
||||
[ð](#lib:operator%25=,duration_)
|
||||
|
||||
`constexpr duration& operator%=(const duration& rhs);
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1553)
|
||||
|
||||
*Effects*: Equivalent to: rep_ %= rhs.count()[.](#19.sentence-1)
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1557)
|
||||
|
||||
*Returns*: *this[.](#20.sentence-1)
|
||||
115
cppdraft/time/duration/cast.md
Normal file
115
cppdraft/time/duration/cast.md
Normal file
@@ -0,0 +1,115 @@
|
||||
[time.duration.cast]
|
||||
|
||||
# 30 Time library [[time]](./#time)
|
||||
|
||||
## 30.5 Class template duration [[time.duration]](time.duration#cast)
|
||||
|
||||
### 30.5.8 Conversions [time.duration.cast]
|
||||
|
||||
[ð](#lib:duration,duration_cast)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1827)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1831)
|
||||
|
||||
*Returns*: Let CF be ratio_divide<Period, typename ToDuration::period>, and CR be common_type<typename ToDuration::rep, Rep, intmax_t>::type[.](#2.sentence-1)
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
If CF::num == 1 and CF::den == 1, returnsToDuration(static_cast<typename ToDuration::rep>(d.count()))
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
otherwise, if CF::num != 1 and CF::den == 1, returnsToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) * static_cast<CR>(CF::num)))
|
||||
|
||||
- [(2.3)](#2.3)
|
||||
|
||||
otherwise, if CF::num == 1 and CF::den != 1, returnsToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) / static_cast<CR>(CF::den)))
|
||||
|
||||
- [(2.4)](#2.4)
|
||||
|
||||
otherwise, returnsToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) * static_cast<CR>(CF::num) / static_cast<CR>(CF::den)))
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1861)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This function does not use any implicit conversions; all conversions
|
||||
are done with static_cast[.](#3.sentence-1)
|
||||
|
||||
It avoids multiplications and divisions when
|
||||
it is known at compile time that one or more arguments is 1[.](#3.sentence-2)
|
||||
|
||||
Intermediate
|
||||
computations are carried out in the widest representation and only converted to
|
||||
the destination representation at the final step[.](#3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:floor,duration)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration floor(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1878)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1882)
|
||||
|
||||
*Returns*: The greatest result t representable in ToDuration for which t <= d[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:ceil,duration)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration ceil(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1895)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1899)
|
||||
|
||||
*Returns*: The least result t representable in ToDuration for which t >= d[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:round,duration)
|
||||
|
||||
`template<class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration round(const duration<Rep, Period>& d);
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1912)
|
||||
|
||||
*Constraints*: ToDuration is a specialization of duration andtreat_as_floating_point_v<typename ToDuration::rep> is false[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L1917)
|
||||
|
||||
*Returns*: The value of ToDuration that is closest to d[.](#9.sentence-1)
|
||||
|
||||
If there are two closest values, then return the value t for which t % 2 == 0[.](#9.sentence-2)
|
||||
93
cppdraft/time/duration/comparisons.md
Normal file
93
cppdraft/time/duration/comparisons.md
Normal file
@@ -0,0 +1,93 @@
|
||||
[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)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user