class Time
Defined at line 763 of file ../../third_party/abseil-cpp/absl/time/time.h
Time
An `absl::Time` represents a specific instant in time. Arithmetic operators
are provided for naturally expressing time calculations. Instances are
created using `absl::Now()` and the `absl::From*()` factory functions that
accept the gamut of other time representations. Formatting and parsing
functions are provided for conversion to and from strings. `absl::Time`
should be passed by value rather than const reference.
`absl::Time` assumes there are 60 seconds in a minute, which means the
underlying time scales must be "smeared" to eliminate leap seconds.
See https://developers.google.com/time/smear.
Even though `absl::Time` supports a wide range of timestamps, exercise
caution when using values in the distant past. `absl::Time` uses the
Proleptic Gregorian calendar, which extends the Gregorian calendar backward
to dates before its introduction in 1582.
See https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar
for more information. Use the ICU calendar classes to convert a date in
some other calendar (http://userguide.icu-project.org/datetime/calendar).
Similarly, standardized time zones are a reasonably recent innovation, with
the Greenwich prime meridian being established in 1884. The TZ database
itself does not profess accurate offsets for timestamps prior to 1970. The
breakdown of future timestamps is subject to the whim of regional
governments.
The `absl::Time` class represents an instant in time as a count of clock
ticks of some granularity (resolution) from some starting point (epoch).
`absl::Time` uses a resolution that is high enough to avoid loss in
precision, and a range that is wide enough to avoid overflow, when
converting between tick counts in most Google time scales (i.e., resolution
of at least one nanosecond, and range +/-100 billion years). Conversions
between the time scales are performed by truncating (towards negative
infinity) to the nearest representable point.
Examples:
absl::Time t1 = ...;
absl::Time t2 = t1 + absl::Minutes(2);
absl::Duration d = t2 - t1; // == absl::Minutes(2)
Public Methods
Breakdown In (TimeZone tz)
Time::In()
Returns the breakdown of this instant in the given TimeZone.
Deprecated. Use `absl::TimeZone::At(Time)`.
void Time ()
Returns the Unix epoch. However, those reading your code may not know
or expect the Unix epoch as the default value, so make your code more
readable by explicitly initializing all instances before use.
Example:
absl::Time t = absl::UnixEpoch();
absl::Time t = absl::Now();
absl::Time t = absl::TimeFromTimeval(tv);
absl::Time t = absl::InfinitePast();
Defined at line 776 of file ../../third_party/abseil-cpp/absl/time/time.h
void Time (const Time & t)
Copyable.
Defined at line 779 of file ../../third_party/abseil-cpp/absl/time/time.h
Time & operator= (const Time & t)
Defined at line 780 of file ../../third_party/abseil-cpp/absl/time/time.h
Time & operator+= (Duration d)
Assignment operators.
Defined at line 783 of file ../../third_party/abseil-cpp/absl/time/time.h
Time & operator-= (Duration d)
Defined at line 787 of file ../../third_party/abseil-cpp/absl/time/time.h
Records
Friends
Time Time ()
Time Time ()
Time Time ()
Duration Time (Time lhs, Time rhs)
bool Time (Time lhs, Time rhs)
bool Time (Time lhs, Time rhs)
Duration Time (Time t)
Time Time (Duration d)
template <typename H>
H Time (H hTime t)