From Jason Turner

[time.zone.exception.nonexist]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp852vvzvh/{from.md → to.md} +65 -0
tmp/tmp852vvzvh/{from.md → to.md} RENAMED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class `nonexistent_local_time` <a id="time.zone.exception.nonexist">[[time.zone.exception.nonexist]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::chrono {
5
+ class nonexistent_local_time : public runtime_error {
6
+ public:
7
+ template<class Duration>
8
+ nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
9
+ };
10
+ }
11
+ ```
12
+
13
+ `nonexistent_local_time` is thrown when an attempt is made to convert a
14
+ non-existent `local_time` to a `sys_time` without specifying
15
+ `choose::earliest` or `choose::latest`.
16
+
17
+ ``` cpp
18
+ template<class Duration>
19
+ nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
20
+ ```
21
+
22
+ *Preconditions:* `i.result == local_info::nonexistent` is `true`.
23
+
24
+ *Effects:* Initializes the base class with a sequence of `char`
25
+ equivalent to that produced by `os.str()` initialized as shown below:
26
+
27
+ ``` cpp
28
+ ostringstream os;
29
+ os << tp << " is in a gap between\n"
30
+ << local_seconds{i.first.end.time_since_epoch()} + i.first.offset << ' '
31
+ << i.first.abbrev << " and\n"
32
+ << local_seconds{i.second.begin.time_since_epoch()} + i.second.offset << ' '
33
+ << i.second.abbrev
34
+ << " which are both equivalent to\n"
35
+ << i.first.end << " UTC";
36
+ ```
37
+
38
+ [*Example 1*:
39
+
40
+ ``` cpp
41
+ #include <chrono>
42
+ #include <iostream>
43
+
44
+ int main() {
45
+ using namespace std::chrono;
46
+ try {
47
+ auto zt = zoned_time{"America/New_York",
48
+ local_days{Sunday[2]/March/2016} + 2h + 30min};
49
+ } catch (const nonexistent_local_time& e) {
50
+ std::cout << e.what() << '\n';
51
+ }
52
+ }
53
+ ```
54
+
55
+ Produces the output:
56
+
57
+ ``` text
58
+ 2016-03-13 02:30:00 is in a gap between
59
+ 2016-03-13 02:00:00 EST and
60
+ 2016-03-13 03:00:00 EDT which are both equivalent to
61
+ 2016-03-13 07:00:00 UTC
62
+ ```
63
+
64
+ — *end example*]
65
+