struct TimeInfo
Defined at line 195 of file ../../third_party/cobalt/src/lib/util/datetime_util.h
A struct for passing time information to methods.
Public Members
uint32_t day_index
uint32_t hour_id
Public Methods
TimeInfo FromHourId (uint32_t hour_id)
Create a TimeInfo corresponding to the given hour_id. Both the day_index and the hour_id are
set to correspond to the given hour_id.
TimeInfo FromDayIndex (uint32_t day_index)
Create a TimeInfo corresponding to the given day_index. Both the day_index and the hour_id are
set to correspond to the given day_index (hour_id is set to the ID of the first hour of the
day, assuming that daylight savings time is not in force).
lib::statusor::StatusOr<TimeInfo> FromTimePoint (std::chrono::system_clock::time_point time, const util::CivilTimeConverterInterface & civil_time_converter, const MetricDefinition & metric)
Create a TimeInfo corresponding to the given time. Both the day_index and the hour_id are set
to correspond to the start of the given time's period, in the time zone specified by |metric|.
TimeInfo FromTimePointUtc (std::chrono::system_clock::time_point time)
Create a TimeInfo corresponding to the given time with respect to UTC. Both the day_index and
the hour_id are set to correspond to the start of the given time's period.
TimeInfo FromTimePoint (std::chrono::system_clock::time_point time, MetricDefinition::TimeZonePolicy time_zone)
DEPRECATED: to be replaced by the method taking a `CivilTimeConverterInterface`.
Create a TimeInfo corresponding to the given time. Both the day_index and the hour_id are set
to correspond to the start of the given time's period, for the specified time zone policy. Only
supports UTC and LOCAL time zone policies.