Lines Matching refs:TimeDelta
145 EXPECT_TRUE((a - b) < TimeDelta::FromSeconds(1)); in TEST_F()
154 EXPECT_TRUE((a - b) < TimeDelta::FromSeconds(1)); in TEST_F()
366 t = Time::UnixEpoch() - TimeDelta::FromMicroseconds(1); in TEST_F()
378 t = Time::UnixEpoch() - TimeDelta::FromMicroseconds(1000); in TEST_F()
390 t = Time::UnixEpoch() - TimeDelta::FromMicroseconds(1001); in TEST_F()
402 t = Time::UnixEpoch() - TimeDelta::FromMilliseconds(1000); in TEST_F()
414 t = Time::UnixEpoch() - TimeDelta::FromMilliseconds(1001); in TEST_F()
439 t = Time::UnixEpoch() + TimeDelta::FromMicroseconds(1); in TEST_F()
451 t = Time::UnixEpoch() + TimeDelta::FromMicroseconds(1000); in TEST_F()
463 t = Time::UnixEpoch() + TimeDelta::FromMilliseconds(1000); in TEST_F()
475 t = Time::UnixEpoch() + TimeDelta::FromMilliseconds(1001); in TEST_F()
576 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); in TEST()
578 TimeDelta delta = ticks_stop - ticks_start; in TEST()
618 TimeDelta delta; in HighResClockTest()
656 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); in TEST()
659 TimeDelta delta = end - begin; in TEST()
660 TimeDelta delta_thread = end_thread - begin_thread; in TEST()
664 TimeDelta difference = delta - delta_thread; in TEST()
671 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(1000); in TEST()
714 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(4000); in TEST()
725 TEST(TimeDelta, FromAndIn) { in TEST() argument
726 EXPECT_TRUE(TimeDelta::FromDays(2) == TimeDelta::FromHours(48)); in TEST()
727 EXPECT_TRUE(TimeDelta::FromHours(3) == TimeDelta::FromMinutes(180)); in TEST()
728 EXPECT_TRUE(TimeDelta::FromMinutes(2) == TimeDelta::FromSeconds(120)); in TEST()
729 EXPECT_TRUE(TimeDelta::FromSeconds(2) == TimeDelta::FromMilliseconds(2000)); in TEST()
730 EXPECT_TRUE(TimeDelta::FromMilliseconds(2) == in TEST()
731 TimeDelta::FromMicroseconds(2000)); in TEST()
732 EXPECT_TRUE(TimeDelta::FromSecondsD(2.3) == in TEST()
733 TimeDelta::FromMilliseconds(2300)); in TEST()
734 EXPECT_TRUE(TimeDelta::FromMillisecondsD(2.5) == in TEST()
735 TimeDelta::FromMicroseconds(2500)); in TEST()
736 EXPECT_EQ(13, TimeDelta::FromDays(13).InDays()); in TEST()
737 EXPECT_EQ(13, TimeDelta::FromHours(13).InHours()); in TEST()
738 EXPECT_EQ(13, TimeDelta::FromMinutes(13).InMinutes()); in TEST()
739 EXPECT_EQ(13, TimeDelta::FromSeconds(13).InSeconds()); in TEST()
740 EXPECT_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF()); in TEST()
741 EXPECT_EQ(13, TimeDelta::FromMilliseconds(13).InMilliseconds()); in TEST()
742 EXPECT_EQ(13.0, TimeDelta::FromMilliseconds(13).InMillisecondsF()); in TEST()
743 EXPECT_EQ(13, TimeDelta::FromSecondsD(13.1).InSeconds()); in TEST()
744 EXPECT_EQ(13.1, TimeDelta::FromSecondsD(13.1).InSecondsF()); in TEST()
745 EXPECT_EQ(13, TimeDelta::FromMillisecondsD(13.3).InMilliseconds()); in TEST()
746 EXPECT_EQ(13.3, TimeDelta::FromMillisecondsD(13.3).InMillisecondsF()); in TEST()
747 EXPECT_EQ(13, TimeDelta::FromMicroseconds(13).InMicroseconds()); in TEST()
748 EXPECT_EQ(3.456, TimeDelta::FromMillisecondsD(3.45678).InMillisecondsF()); in TEST()
752 TEST(TimeDelta, TimeSpecConversion) { in TEST() argument
753 struct timespec result = TimeDelta::FromSeconds(0).ToTimeSpec(); in TEST()
757 result = TimeDelta::FromSeconds(1).ToTimeSpec(); in TEST()
761 result = TimeDelta::FromMicroseconds(1).ToTimeSpec(); in TEST()
765 result = TimeDelta::FromMicroseconds( in TEST()
775 TEST(TimeDelta, WindowsEpoch) { in TEST() argument
802 TEST(TimeDelta, Magnitude) { in TEST() argument
804 EXPECT_EQ(TimeDelta::FromMicroseconds(zero), in TEST()
805 TimeDelta::FromMicroseconds(zero).magnitude()); in TEST()
809 EXPECT_EQ(TimeDelta::FromMicroseconds(one), in TEST()
810 TimeDelta::FromMicroseconds(one).magnitude()); in TEST()
811 EXPECT_EQ(TimeDelta::FromMicroseconds(one), in TEST()
812 TimeDelta::FromMicroseconds(negative_one).magnitude()); in TEST()
816 EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one), in TEST()
817 TimeDelta::FromMicroseconds(max_int64_minus_one).magnitude()); in TEST()
818 EXPECT_EQ(TimeDelta::FromMicroseconds(max_int64_minus_one), in TEST()
819 TimeDelta::FromMicroseconds(min_int64_plus_two).magnitude()); in TEST()
822 TEST(TimeDelta, Max) { in TEST() argument
823 TimeDelta max = TimeDelta::Max(); in TEST()
825 EXPECT_EQ(max, TimeDelta::Max()); in TEST()
826 EXPECT_GT(max, TimeDelta::FromDays(100 * 365)); in TEST()
827 EXPECT_GT(max, TimeDelta()); in TEST()
830 bool IsMin(TimeDelta delta) { in IsMin()
834 TEST(TimeDelta, MaxConversions) { in TEST() argument
835 TimeDelta t = TimeDelta::Max(); in TEST()
847 t = TimeDelta::FromDays(std::numeric_limits<int>::max()); in TEST()
850 t = TimeDelta::FromHours(std::numeric_limits<int>::max()); in TEST()
853 t = TimeDelta::FromMinutes(std::numeric_limits<int>::max()); in TEST()
858 t = TimeDelta::FromSeconds(max_int / Time::kMicrosecondsPerSecond + 1); in TEST()
861 t = TimeDelta::FromMilliseconds(max_int / Time::kMillisecondsPerSecond + 1); in TEST()
864 t = TimeDelta::FromMicroseconds(max_int); in TEST()
867 t = TimeDelta::FromSeconds(-max_int / Time::kMicrosecondsPerSecond - 1); in TEST()
870 t = TimeDelta::FromMilliseconds(-max_int / Time::kMillisecondsPerSecond - 1); in TEST()
873 t = TimeDelta::FromMicroseconds(-max_int); in TEST()
876 t = -TimeDelta::FromMicroseconds(std::numeric_limits<int64_t>::min()); in TEST()
879 t = TimeDelta::FromSecondsD(std::numeric_limits<double>::infinity()); in TEST()
884 t = TimeDelta::FromSecondsD(max_d / Time::kMicrosecondsPerSecond + 1); in TEST()
887 t = TimeDelta::FromMillisecondsD(std::numeric_limits<double>::infinity()); in TEST()
890 t = TimeDelta::FromMillisecondsD(max_d / Time::kMillisecondsPerSecond * 2); in TEST()
893 t = TimeDelta::FromSecondsD(-max_d / Time::kMicrosecondsPerSecond - 1); in TEST()
896 t = TimeDelta::FromMillisecondsD(-max_d / Time::kMillisecondsPerSecond * 2); in TEST()
900 TEST(TimeDelta, NumericOperators) { in TEST() argument
902 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
903 TimeDelta::FromMilliseconds(1000) * d); in TEST()
904 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
905 TimeDelta::FromMilliseconds(1000) / d); in TEST()
906 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
907 TimeDelta::FromMilliseconds(1000) *= d); in TEST()
908 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
909 TimeDelta::FromMilliseconds(1000) /= d); in TEST()
910 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
911 d * TimeDelta::FromMilliseconds(1000)); in TEST()
914 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
915 TimeDelta::FromMilliseconds(1000) * f); in TEST()
916 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
917 TimeDelta::FromMilliseconds(1000) / f); in TEST()
918 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
919 TimeDelta::FromMilliseconds(1000) *= f); in TEST()
920 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
921 TimeDelta::FromMilliseconds(1000) /= f); in TEST()
922 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
923 f * TimeDelta::FromMilliseconds(1000)); in TEST()
926 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
927 TimeDelta::FromMilliseconds(1000) * i); in TEST()
928 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
929 TimeDelta::FromMilliseconds(1000) / i); in TEST()
930 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
931 TimeDelta::FromMilliseconds(1000) *= i); in TEST()
932 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
933 TimeDelta::FromMilliseconds(1000) /= i); in TEST()
934 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
935 i * TimeDelta::FromMilliseconds(1000)); in TEST()
938 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
939 TimeDelta::FromMilliseconds(1000) * i64); in TEST()
940 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
941 TimeDelta::FromMilliseconds(1000) / i64); in TEST()
942 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
943 TimeDelta::FromMilliseconds(1000) *= i64); in TEST()
944 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
945 TimeDelta::FromMilliseconds(1000) /= i64); in TEST()
946 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
947 i64 * TimeDelta::FromMilliseconds(1000)); in TEST()
949 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
950 TimeDelta::FromMilliseconds(1000) * 0.5); in TEST()
951 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
952 TimeDelta::FromMilliseconds(1000) / 0.5); in TEST()
953 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
954 TimeDelta::FromMilliseconds(1000) *= 0.5); in TEST()
955 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
956 TimeDelta::FromMilliseconds(1000) /= 0.5); in TEST()
957 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
958 0.5 * TimeDelta::FromMilliseconds(1000)); in TEST()
960 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
961 TimeDelta::FromMilliseconds(1000) * 2); in TEST()
962 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
963 TimeDelta::FromMilliseconds(1000) / 2); in TEST()
964 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
965 TimeDelta::FromMilliseconds(1000) *= 2); in TEST()
966 EXPECT_EQ(TimeDelta::FromMilliseconds(500), in TEST()
967 TimeDelta::FromMilliseconds(1000) /= 2); in TEST()
968 EXPECT_EQ(TimeDelta::FromMilliseconds(2000), in TEST()
969 2 * TimeDelta::FromMilliseconds(1000)); in TEST()
972 TEST(TimeDelta, Overflows) { in TEST() argument
974 EXPECT_TRUE(TimeDelta::Max().is_max()); in TEST()
975 EXPECT_TRUE(IsMin(-TimeDelta::Max())); in TEST()
976 EXPECT_GT(TimeDelta(), -TimeDelta::Max()); in TEST()
978 TimeDelta large_delta = TimeDelta::Max() - TimeDelta::FromMilliseconds(1); in TEST()
979 TimeDelta large_negative = -large_delta; in TEST()
980 EXPECT_GT(TimeDelta(), large_negative); in TEST()
983 TimeDelta one_second = TimeDelta::FromSeconds(1); in TEST()
996 TimeDelta delta = large_delta; in TEST()
1040 DCHECK_EQ(TimeDelta(), TimeDelta()); in TEST()
1044 TimeDelta zero; in TEST()
1049 TimeDelta five_hundred_ms = TimeDelta::FromMilliseconds(500); in TEST()
1054 TimeDelta minus_ten_seconds = TimeDelta::FromSeconds(-10); in TEST()
1061 oss << TimeDelta(); in TEST()
1067 oss << TimeDelta(); in TEST()
1105 TimeTicks() + TimeDelta::FromDays(365.25 * 40); in TEST()