Home | History | Annotate | Download | only in base

Lines Matching full:time

5 #include <time.h>
8 #include "base/time.h"
12 using base::Time;
17 TEST(Time, TimeT) {
18 // C library time and exploded time.
19 time_t now_t_1 = time(NULL);
28 Time our_time_1 = Time::FromTimeT(now_t_1);
29 Time::Exploded exploded;
32 // This will test both our exploding and our time_t -> Time conversion.
40 // Convert exploded back to the time struct.
41 Time our_time_2 = Time::FromLocalExploded(exploded);
47 EXPECT_EQ(10, Time().FromTimeT(10).ToTimeT());
48 EXPECT_EQ(10.0, Time().FromTimeT(10).ToDoubleT());
51 EXPECT_EQ(0, Time().ToTimeT());
52 EXPECT_EQ(0, Time::FromTimeT(0).ToInternalValue());
55 TEST(Time, FromExplodedWithMilliseconds) {
58 Time now = Time::NowFromSystemTime();
59 Time::Exploded exploded1 = {0};
62 Time time = Time::FromUTCExploded(exploded1);
63 Time::Exploded exploded2 = {0};
64 time.UTCExplode(&exploded2);
68 TEST(Time, ZeroIsSymmetric) {
69 Time zero_time(Time::FromTimeT(0));
75 TEST(Time, LocalExplode) {
76 Time a = Time::Now();
77 Time::Exploded exploded;
80 Time b = Time::FromLocalExploded(exploded);
88 TEST(Time, UTCExplode) {
89 Time a = Time::Now();
90 Time::Exploded exploded;
93 Time b = Time::FromUTCExploded(exploded);
97 TEST(Time, LocalMidnight) {
98 Time::Exploded exploded;
99 Time::Now().LocalMidnight().LocalExplode(&exploded);
113 // time clock has a finer granularity than the Sleep()
116 // Time(ms timer) Time(us timer)
143 // of time -- less than 15ms. Unfortunately, if we happen to have a
158 // change, we detect the minimum time between measurements.
204 Time::kMicrosecondsPerSecond + 1).ToTimeSpec();
210 // Our internal time format is serialized in things like databases, so it's
214 Time::Exploded exploded;
223 Time t = Time::FromUTCExploded(exploded);
227 // We can't test 1601 epoch, since the system time functions on Linux