Namespaces
Records
Functions
-
bool operator== (time_zone lhs, time_zone rhs)Relational operators.
Defined at line 211 of file ../../third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h
-
bool operator!= (time_zone lhs, time_zone rhs)Defined at line 214 of file ../../third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h
-
template <typename H>H AbslHashValue (H h, time_zone tz)Defined at line 217 of file ../../third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h
-
template <typename D>civil_second convert (const time_point<D> & tp, const time_zone & tz)Returns the civil time (cctz::civil_second) within the given time zone at
the given absolute time (time_point). Since the additional fields provided
by the time_zone::absolute_lookup struct should rarely be needed in modern
code, this convert() function is simpler and should be preferred.
Defined at line 251 of file ../../third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h
-
time_point<seconds> convert (const civil_second & cs, const time_zone & tz)Returns the absolute time (time_point) that corresponds to the given civil
time within the given time zone. If the civil time is not unique (i.e., if
it was either repeated or non-existent), then the returned time_point is
the best estimate that preserves relative order. That is, this function
guarantees that if cs1
<
cs2, then convert(cs1, tz)
<
= convert(cs2, tz).
Defined at line 260 of file ../../third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h
-
bool load_time_zone (const std::string & name, time_zone * tz)Loads the named time zone. May perform I/O on the initial load.
If the name is invalid, or some other kind of error occurs, returns
false and "*tz" is set to the UTC time zone.
-
time_zone utc_time_zone ()Returns a time_zone representing UTC. Cannot fail.
-
time_zone fixed_time_zone (const seconds & offset)Returns a time zone that is a fixed offset (seconds east) from UTC.
Note: If the absolute value of the offset is greater than 24 hours
you'll get UTC (i.e., zero offset) instead.
-
template <typename D>std::string format (const std::string & fmt, const time_point<D> & tp, const time_zone & tz)Formats the given time_point in the given cctz::time_zone according to
the provided format string. Uses strftime()-like formatting options,
with the following extensions:
- %Ez - RFC3339-compatible numeric UTC offset (+hh:mm or -hh:mm)
- %E*z - Full-resolution numeric UTC offset (+hh:mm:ss or -hh:mm:ss)
- %E#S - Seconds with # digits of fractional precision
- %E*S - Seconds with full fractional precision (a literal '*')
- %E#f - Fractional seconds with # digits of precision
- %E*f - Fractional seconds with full precision (a literal '*')
- %E4Y - Four-character years (-999 ... -001, 0000, 0001 ... 9999)
- %ET - The RFC3339 "date-time" separator "T"
Note that %E0S behaves like %S, and %E0f produces no characters. In
contrast %E*f always produces at least one digit, which may be '0'.
Note that %Y produces as many characters as it takes to fully render the
year. A year outside of [-999:9999] when formatted with %E4Y will produce
more than four characters, just like %Y.
Tip: Format strings should include the UTC offset (e.g., %z, %Ez, or %E*z)
so that the resulting string uniquely identifies an absolute time.
Example:
cctz::time_zone lax;
if (!cctz::load_time_zone("America/Los_Angeles",
&lax
)) { ... }
auto tp = cctz::convert(cctz::civil_second(2013, 1, 2, 3, 4, 5), lax);
std::string f = cctz::format("%H:%M:%S", tp, lax); // "03:04:05"
f = cctz::format("%H:%M:%E3S", tp, lax); // "03:04:05.000"
Defined at line 319 of file ../../third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h
-
time_zone local_time_zone ()Returns a time zone representing the local time zone. Falls back to UTC.
Note: local_time_zone.name() may only be something like "localtime".
-
template <typename D>bool parse (const std::string & fmtconst std::string & inputconst time_zone & tztime_point<D> * tpp)Parses an input string according to the provided format string and
returns the corresponding time_point. Uses strftime()-like formatting
options, with the same extensions as cctz::format(), but with the
exceptions that %E#S is interpreted as %E*S, and %E#f as %E*f. %Ez
and %E*z also accept the same inputs, which (along with %z) includes
'z' and 'Z' as synonyms for +00:00. %ET accepts either 'T' or 't'.
%Y consumes as many numeric characters as it can, so the matching data
should always be terminated with a non-numeric. %E4Y always consumes
exactly four characters, including any sign.
Unspecified fields are taken from the default date and time of ...
"1970-01-01 00:00:00.0 +0000"
For example, parsing a string of "15:45" (%H:%M) will return a time_point
that represents "1970-01-01 15:45:00.0 +0000".
Note that parse() returns time instants, so it makes most sense to parse
fully-specified date/time strings that include a UTC offset (%z, %Ez, or
%E*z).
Note also that parse() only heeds the fields year, month, day, hour,
minute, (fractional) second, and UTC offset. Other fields, like weekday (%a
or %A), while parsed for syntactic validity, are ignored in the conversion.
Date and time fields that are out-of-range will be treated as errors rather
than normalizing them like cctz::civil_second() would do. For example, it
is an error to parse the date "Oct 32, 2013" because 32 is out of range.
A second of ":60" is normalized to ":00" of the following minute with
fractional seconds discarded. The following table shows how the given
seconds and subseconds will be parsed:
"59.x" -> 59.x // exact
"60.x" -> 00.0 // normalized
"00.x" -> 00.x // exact
Errors are indicated by returning false.
Example:
const cctz::time_zone tz = ...
std::chrono::system_clock::time_point tp;
if (cctz::parse("%Y-%m-%d", "2015-10-09", tz,
&tp
)) {
...
}
Defined at line 373 of file ../../third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h