diff --git a/tz.html b/tz.html index c632416..165b6e1 100644 --- a/tz.html +++ b/tz.html @@ -26,7 +26,7 @@

Howard E. Hinnant
-2016-05-20
+2016-05-22
Creative
 Commons License
This work is licensed @@ -2088,11 +2088,39 @@ For the overloads taking a zoned_time it is the value returned by

parse

+

+One can parse in a sys_time<Duration> or a +local_time<Duration>. Optionally, one can also pass in a reference +to a std::string in order to capture the time zone abbreviation, or one +can pass in a reference to a std::chrono::minutes to capture a time zone +UTC offset (formatted as +0000), or one can pass in both in either order. +

+
 template <class Duration>
 void
 parse(std::istream& is, const std::string& format, sys_time<Duration>& tp);
 
+template <class Duration>
+void
+parse(std::istream& is, const std::string& format, sys_time<Duration>& tp,
+      std::string& abbrev);
+
+template <class Duration>
+void
+parse(std::istream& is, const std::string& format, sys_time<Duration>& tp,
+      std::chrono::minutes& offset);
+
+template <class Duration>
+void
+parse(std::istream& is, const std::string& format, sys_time<Duration>& tp,
+      std::string& abbrev, std::chrono::minutes& offset);
+
+template <class Duration>
+void
+parse(std::istream& is, const std::string& format, sys_time<Duration>& tp,
+      std::chrono::minutes& offset, std::string& abbrev);
+
 template <class Duration>
 void
 parse(std::istream& is, const std::string& format, local_time<Duration>& tp);
@@ -2101,13 +2129,29 @@ template <class Duration>
 void
 parse(std::istream& is, const std::string& format, local_time<Duration>& tp,
       std::string& abbrev);
+
+template <class Duration>
+void
+parse(std::istream& is, const std::string& format, local_time<Duration>& tp,
+      std::chrono::minutes& offset);
+
+template <class Duration>
+void
+parse(std::istream& is, const std::string& format, local_time<Duration>& tp,
+      std::string& abbrev, std::chrono::minutes& offset);
+
+template <class Duration>
+void
+parse(std::istream& is, const std::string& format, local_time<Duration>& tp,
+      std::chrono::minutes& offset, std::string& abbrev);
 

Effects: These functions attempt to parse a time_point out of is according to format. If the parse is unsuccessful, calls is.setstate(std::ios::failbit) which may throw an exception. -tp is altered only in the event of a successful parse. +tp, abbrev, and offset are altered only in +the event of a successful parse.

@@ -2126,27 +2170,35 @@ contributes to the time stamp as if

  • If %z appears in the format string and an offset is -successfully parsed, the first overload (sys_time) interprets the +successfully parsed, the overloads taking sys_time interprets the parsed time as a local time and subtracts the offset prior to assigning the value to tp, resulting in a value of tp representing a -UTC timestamp. The second and third overloads require a valid parse of the -offset, but then ignore the offset in assigning a value to the -local_time<Duration>& tp. +UTC timestamp. The overloads taking local_time require a valid +parse of the offset, but then ignore the offset in assigning a value to the +local_time<Duration>& tp. If offset is +passed in, on successful parse it will hold the value represented by +%z if present, or will be assigned 0min if +%z is not present.

  • -If %Z appears in the format string then an abbreviation -is required in that position for a successful parse. However the parsed abbreviation -does not have to be a valid time zone abbreviation, and has no impact on the value -parsed into tp. Using the third overload one can discover what that -parsed abbreviation is. If the third overload is used, but %Z does -not appear in the format, then abbrev is not altered. +If %Z appears in the format string then an +abbreviation is required in that position for a successful parse. The +abbreviation will be parsed as a std::string (delimited by white +space). The parsed abbreviation does not have to be a valid time zone +abbreviation, and has no impact on the value parsed into tp. Using +the overloads that take a std::string& one can discover what +that parsed abbreviation is. On successful parse, abbrev will be +assigned the value represented by %Z if present, or assigned the +empty string if %Z is not present.

  • Note: There is no unique mapping from a time zone abbreviation to a -time_zone. +time_zone. But given a time zone abbreviation and a sys_time +or local_time, one could make a list of potential time_zones. +Given a UTC offset, one might even narrow that list down further.