#include <stdint.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <optional>
#include "base/check.h"
#include "base/notreached.h"
#include "base/numerics/safe_math.h"
#include "base/time/time.h"
#include "base/time/time_override.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_ANDROID) && !defined(__LP64__)
#include <time64.h>
#endif
#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE)
#error "This implementation is for POSIX platforms other than Fuchsia or Mac."
#endif
namespace {
int64_t ConvertTimespecToMicros(const struct timespec& ts) { … }
#if (BUILDFLAG(IS_POSIX) && defined(_POSIX_MONOTONIC_CLOCK) && \
_POSIX_MONOTONIC_CLOCK >= 0) || \
BUILDFLAG(IS_BSD) || BUILDFLAG(IS_ANDROID)
int64_t ClockNow(clockid_t clk_id) { … }
std::optional<int64_t> MaybeClockNow(clockid_t clk_id) { … }
#else
#error No usable tick clock function on this platform.
#endif
}
namespace base {
namespace subtle {
Time TimeNowIgnoringOverride() { … }
Time TimeNowFromSystemTimeIgnoringOverride() { … }
}
namespace subtle {
TimeTicks TimeTicksNowIgnoringOverride() { … }
std::optional<TimeTicks> MaybeTimeTicksNowIgnoringOverride() { … }
}
TimeTicks::Clock TimeTicks::GetClock() { … }
bool TimeTicks::IsHighResolution() { … }
bool TimeTicks::IsConsistentAcrossProcesses() { … }
namespace subtle {
ThreadTicks ThreadTicksNowIgnoringOverride() { … }
}
}