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