7#include "flutter/fml/time/chrono_timestamp_provider.h"
8#include "flutter/fml/time/time_delta.h"
9#include "gtest/gtest.h"
16 for (
int i = 0;
i < 3; ++
i) {
18 EXPECT_GE(now, start);
19 std::this_thread::yield();
23TEST(Time, IntConversions) {
26 EXPECT_EQ(102304506708ll,
delta.ToNanoseconds());
27 EXPECT_EQ(102304506ll,
delta.ToMicroseconds());
28 EXPECT_EQ(102304ll,
delta.ToMilliseconds());
29 EXPECT_EQ(102ll,
delta.ToSeconds());
32TEST(Time, FloatConversions) {
35 EXPECT_FLOAT_EQ(102304506708.0,
delta.ToNanosecondsF());
36 EXPECT_FLOAT_EQ(102304506.708,
delta.ToMicrosecondsF());
37 EXPECT_FLOAT_EQ(102304.506708,
delta.ToMillisecondsF());
38 EXPECT_FLOAT_EQ(102.304506708,
delta.ToSecondsF());
41TEST(Time, TimespecConversions) {
46 EXPECT_EQ(5, from_timespec.ToSeconds());
47 EXPECT_EQ(5 * 1000000000ll + 7, from_timespec.ToNanoseconds());
48 struct timespec to_timespec = from_timespec.ToTimespec();
49 EXPECT_EQ(ts.tv_sec, to_timespec.tv_sec);
50 EXPECT_EQ(ts.tv_nsec, to_timespec.tv_nsec);
static constexpr TimeDelta FromTimespec(struct timespec ts)
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
fml::TimePoint ChronoTicksSinceEpoch()
TEST(MallocMapping, EmptyContructor)