time point class¶
-
class Time¶
The
turbo::Timeclass represents a specific instant in time.Arithmetic operators are provided for naturally expressing time calculations. Instances are created using
turbo::time_now()and theturbo::From*()factory functions that accept the gamut of other time representations. Formatting and parsing functions are provided for conversion to and from strings.turbo::Timeshould be passed by value rather than const reference.turbo::Timeassumes 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
turbo::Timesupports a wide range of timestamps, exercise caution when using values in the distant past.turbo::Timeuses 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
turbo::Timeclass represents an instant in time as a count of clock ticks of some granularity (resolution) from some starting point (epoch).turbo::Timeuses 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:
turbo::Time t1 = ...; turbo::Time t2 = t1 + turbo::minutes(2); turbo::Duration d = t2 - t1; // == turbo::minutes(2)
-
struct Breakdown¶
-
struct Breakdown¶