forked from HowardHinnant/date
Specify exception constructors
* For nonexistent_local_time and ambiguous_local_time. * Simplify the constructors. * Make these exceptions usable for custom time zones.
This commit is contained in:
10753
d0355r5.html
Normal file
10753
d0355r5.html
Normal file
File diff suppressed because it is too large
Load Diff
60
tz.html
60
tz.html
@@ -26,7 +26,7 @@
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="mailto:howard.hinnant@gmail.com">Howard E. Hinnant</a><br/>
|
||||
2017-10-16<br/>
|
||||
2017-10-24<br/>
|
||||
</address>
|
||||
<hr/>
|
||||
<h1 align=center>Time Zone Database Parser</h1>
|
||||
@@ -1506,9 +1506,37 @@ class nonexistent_local_time
|
||||
: public std::runtime_error
|
||||
{
|
||||
public:
|
||||
// Construction is undocumented
|
||||
template <class Duration>
|
||||
nonexistent_local_time(local_time<Duration> tp, const local_info& i);
|
||||
};
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
template <class Duration>
|
||||
nonexistent_local_time::nonexistent_local_time(local_time<Duration> tp,
|
||||
const local_info& i);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>
|
||||
<i>Requires:</i> <code>i.result == local_info::nonexistent</code>.
|
||||
</p>
|
||||
<p>
|
||||
<i>Effects:</i> Constructs a <code>nonexistent_local_time</code> by initializing
|
||||
the base class with a sequence of <code>char</code> equivalent to that produced
|
||||
by <code>os.str()</code> initialized as shown below:
|
||||
</p>
|
||||
<pre>
|
||||
std::ostringstream os;
|
||||
os << tp << " is in a gap between\n"
|
||||
<< local_seconds{i.first.end.time_since_epoch()} + i.first.offset << ' '
|
||||
<< i.first.abbrev << " and\n"
|
||||
<< local_seconds{i.second.begin.time_since_epoch()} + i.second.offset << ' '
|
||||
<< i.second.abbrev
|
||||
<< " which are both equivalent to\n"
|
||||
<< i.first.end << " UTC";
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
[<i>Example:</i>
|
||||
</p>
|
||||
@@ -1560,9 +1588,35 @@ class ambiguous_local_time
|
||||
: public std::runtime_error
|
||||
{
|
||||
public:
|
||||
// Construction is undocumented
|
||||
template <class Duration>
|
||||
ambiguous_local_time(local_time<Duration> tp, const local_info& i);
|
||||
};
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
template <class Duration>
|
||||
ambiguous_local_time::ambiguous_local_time(local_time<Duration> tp,
|
||||
const local_info& i);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>
|
||||
<i>Requires:</i> <code>i.result == local_info::ambiguous</code>.
|
||||
</p>
|
||||
<p>
|
||||
<i>Effects:</i> Constructs an <code>ambiguous_local_time</code> by initializing
|
||||
the base class with a sequence of <code>char</code> equivalent to that produced
|
||||
by <code>os.str()</code> initialized as shown below:
|
||||
</p>
|
||||
<pre>
|
||||
std::ostringstream os;
|
||||
os << tp << " is ambiguous. It could be\n"
|
||||
<< tp << ' ' << i.first.abbrev << " == "
|
||||
<< tp - i.first.offset << " UTC or\n"
|
||||
<< tp << ' ' << i.second.abbrev << " == "
|
||||
<< tp - i.second.offset << " UTC";
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
[<i>Example:</i>
|
||||
</p>
|
||||
|
Reference in New Issue
Block a user