Namespaces
Records
-
class AlwaysAccurateClock -
class BaseProtectedFields -
class BootClock -
class BootClockInterface -
class CalendarDate -
class CivilTimeConverterInterface -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class ContextFormatter -
class EncryptedMessageMaker -
class FileSystem -
class NamedType -
class NotNullSharedPtr -
class NotNullUniquePtr -
class PathTag -
class PemUtil -
class PinnedUniquePtr -
class PosixFileSystem -
class Sleeper -
class SleeperInterface -
class SourceLocation -
class StatusBuilder -
class SteadyClock -
class SteadyClockInterface -
class SystemClock -
class SystemClockInterface -
class TimeInfo -
class UnencryptedMessageMaker -
class UtcTimeConverter -
class ValidatedClockInterface
Functions
-
lib::statusor::StatusOr<std::string> ReadTextFile (const Path & file_path) -
lib::statusor::StatusOr<std::string> ReadNonEmptyTextFile (const Path & file_path) -
lib::statusor::StatusOr<std::string> ReadHexFile (const Path & file_path) -
std::string ReadHexFileOrDefault (const Path & file_path, const std::string & default_string) -
std::string ReadHexFileOrDefault (const std::string & file_path, const std::string & default_string)DEPRECATED: TODO(https://fxbug.dev/278930401): Remove once not used in Fuchsia
-
template <typename U, class... Args>NotNullUniquePtr<U> MakeNotNullUniquePtr (Args &&... args) -
template <typename U, typename V, class... Args>NotNullUniquePtr<V> WrapNotNullUniquePtrOrDefault (std::unique_ptr<V> && other, Args &&... args) -
template <typename U>NotNullUniquePtr<U> TESTONLY_TakeRawPointer (U * other) -
template <typename U>lib::statusor::StatusOr<NotNullUniquePtr<U>> WrapNotNullUniquePtr (std::unique_ptr<U> && other) -
lib::statusor::StatusOr<uint32_t> TimePointToHourId (std::chrono::system_clock::time_point time_point, const util::CivilTimeConverterInterface & civil_time_converter, const MetricDefinition & metric)Returns the hour ID for a time point, with respect to the time zone specified by `metric`'s time
zone policy. Prefer `TimeInfo::FromTimePoint()` when both the day index and hour ID are needed.
-
lib::statusor::StatusOr<uint32_t> TimePointToDayIndex (std::chrono::system_clock::time_point time_point, const util::CivilTimeConverterInterface & civil_time_converter, const MetricDefinition & metric)Returns the day index for a time point, with respect to the time zone specified by `metric`'s
time zone policy. Prefer `TimeInfo::FromTimePoint()` when both the day index and hour ID are
needed.
-
uint32_t TimePointToHourIdUtc (std::chrono::system_clock::time_point time_point)Returns the hour id for a time point, with respect to UTC. Prefer
`TimeInfo::FromTimePointUtc()` when both the day index and hour ID are needed.
-
uint32_t TimePointToDayIndexUtc (std::chrono::system_clock::time_point time_point)Returns the day index for a time point, with respect to UTC. Prefer
`TimeInfo::FromTimePointUtc()` when both the day index and hour ID are needed.
-
uint32_t TimeToHourId (time_t time, MetricDefinition::TimeZonePolicy time_zone)DEPRECATED: to be replaced by `TimePointToHourId`.
Returns the hour identifier. The hour identifier is calculated as follows:
(TimeToDayIndex(time, time_zone) * 48) + (tm_hour * 2) + (tm_dst ? 0 : 1)
See: https://fuchsia.googlesource.com/cobalt/+/master/docs/hour_id.md
-
uint32_t TimeToDayIndex (time_t time, MetricDefinition::TimeZonePolicy time_zone)DEPRECATED: to be replaced by `TimePointToDayIndex`.
Returns the day index corresponding to |time| in the given |time_zone|
or UINT32_MAX if |time_zone| is not valid. |time| must be a Unix timestamp,
that is a number of Unix seconds since the Unix epoch.
-
time_t MidnightUtcFromDayIndex (uint32_t day_index)Returns the Unix time for midnight of the day with the given |day_index|
in UTC.
-
uint32_t CalendarDateToDayIndex (const CalendarDate & calendar_date)Converts the given CalendarDate to a Cobalt Day Index. If the fields of
calendar_date do not make sense as a real day of the calendar
(for example if month=13) then the result is undefined. If the
specified date is prior to January 1, 1970 or not before the year 10,000
then the result is undefined.
-
CalendarDate DayIndexToCalendarDate (uint32_t day_index)Converts the given day_index to a CalendarDate, necessarily on or
after January 1, 1970.
-
uint32_t DayIndexToWeekIndex (uint32_t day_index)Given a day_index returns the index of the Cobalt week epoch
containing that date.
-
uint32_t DayIndexToHourIdNoDst (uint32_t day_index)Given a day index, returns the hour identifier for the start of that day, assuming that DST is
not in force.
-
uint32_t HourIdToDayIndex (uint32_t hour_id)Given an hour identifier, returns the index of the Cobalt day containing that hour.
-
uint32_t CalendarDateToWeekIndex (const CalendarDate & calendar_date)Given a CalendarDate returns the index of the Cobalt week epoch
containing that date. If the fields of calendar_date do not make sense as a
real day of the calendar (for example if month=13) then the result is
undefined. If the specified date is prior to January 1, 1970 then the result
is undefined.
-
CalendarDate WeekIndexToCalendarDate (uint32_t week_index)Given the index of a Cobalt week epoch returns the CalendarDate for the first
day of that week epoch. In all cases except week_index=0 the
returned date will be a Sunday. If week_index=0 the returned date will
be day zero: Thu 1970-1-1.
-
uint32_t DayIndexToMonthIndex (uint32_t day_index)Given a day_index returns the index of the Cobalt month epoch
containing that date.
-
uint32_t CalendarDateToMonthIndex (const CalendarDate & calendar_date)Given a CalendarDate returns the index of the Cobalt month epoch
containing that date. If the fields of
calendar_date do not make sense as a real day of the calendar (for example if
month=13) then the result is undefined. If the specified date is prior to
January 1, 1970 then the result is undefined.
-
CalendarDate MonthIndexToCalendarDate (uint32_t month_index)Given the index of a Cobalt month epoch returns the CalendarDate for the
first day of that month epoch.
-
int64_t ToUnixSeconds (std::chrono::system_clock::time_point t)Returns the the given time as a number of seconds since the Unix epoch.
-
int64_t DayIndexToUnixSeconds (uint32_t day_index) -
int64_t HourIdToUnixSeconds (uint32_t hour_id) -
std::chrono::system_clock::time_point FromUnixSeconds (int64_t seconds)Returns the given number of seconds since the Unix epoch as a time_point.
-
template <typename T, typename U, class... Args>NotNullUniquePtr<U> WrapNotNullUniquePtrOrDefault (std::unique_ptr<U> && other, Args &&... args)WrapNotNullUniquePtrOrDefault allows converting std::unique_ptr into a NotNullUniquePtr. It
does this by taking arguments for a fallback constructor after the std::unique_ptr argument. If
the provided std::unique_ptr happens to be null, the fallback constructor will be used. This
way the pointer is guaranteed never to be null.
Defined at line 98 of file ../../third_party/cobalt/src/lib/util/not_null.h
-
std::ostream & operator<< (std::ostream & o, const TimeInfo & a)Stream operator useful for logging TimeInfo objects.
-
std::ostream & operator<< (std::ostream & os, const NamedType<T, Tag> & other)Defined at line 83 of file ../../third_party/cobalt/src/lib/util/named_type.h
-
template <typename T, class... Args>NotNullUniquePtr<T> MakeNotNullUniquePtr (Args &&... args)MakeNotNullUniquePtr is equivalent to std::make_unique, and constructs a NotNullUniquePtr that
is guaranteed to not be null.
Defined at line 89 of file ../../third_party/cobalt/src/lib/util/not_null.h
-
template <typename T>lib::statusor::StatusOr<NotNullSharedPtr<T>> MaybeWrapNotNullSharedPtr (std::shared_ptr<T> && other)Defined at line 252 of file ../../third_party/cobalt/src/lib/util/not_null.h
-
template <typename U>lib::statusor::StatusOr<NotNullSharedPtr<U>> MaybeWrapNotNullSharedPtr (std::shared_ptr<U> && other) -
template <typename T>NotNullUniquePtr<T> TESTONLY_TakeRawPointer (T * other)TESTONLY_TakeRawPointer takes a (possible null) pointer to an object of type T. If the pointer
is non-null, it will return a NotNullUniquePtr
<T
> that takes ownership of the provided pointer.
Otherwise it will CHECK-fail.
Defined at line 110 of file ../../third_party/cobalt/src/lib/util/not_null.h
-
template <typename T>lib::statusor::StatusOr<NotNullUniquePtr<T>> WrapNotNullUniquePtr (std::unique_ptr<T> && other)WrapNotNullUniquePtr takes a (possible null) pointer to an object of type T. If the pointer is
non-null, it will return a NotNullUniquePtr
<T
> that takes ownership of the provided pointer.
Otherwise it will return a non-OK status.
Defined at line 119 of file ../../third_party/cobalt/src/lib/util/not_null.h