llvm.org GIT mirror llvm / 77bf4f9
Cleaning up static initializers in TimeValue. Code reviewed by Chandlerc git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216703 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman 6 years ago
4 changed file(s) with 22 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
3737 /// value permissible by the class. MinTime is some point
3838 /// in the distant past, about 300 billion years BCE.
3939 /// @brief The smallest possible time value.
40 static const TimeValue MinTime;
40 static TimeValue MinTime() {
41 return TimeValue ( INT64_MIN,0 );
42 }
4143
4244 /// A constant TimeValue representing the largest time
4345 /// value permissible by the class. MaxTime is some point
4446 /// in the distant future, about 300 billion years AD.
4547 /// @brief The largest possible time value.
46 static const TimeValue MaxTime;
48 static TimeValue MaxTime() {
49 return TimeValue ( INT64_MAX,0 );
50 }
4751
4852 /// A constant TimeValue representing the base time,
4953 /// or zero time of 00:00:00 (midnight) January 1st, 2000.
5054 /// @brief 00:00:00 Jan 1, 2000 UTC.
51 static const TimeValue ZeroTime;
55 static TimeValue ZeroTime() {
56 return TimeValue ( 0,0 );
57 }
5258
5359 /// A constant TimeValue for the Posix base time which is
5460 /// 00:00:00 (midnight) January 1st, 1970.
5561 /// @brief 00:00:00 Jan 1, 1970 UTC.
56 static const TimeValue PosixZeroTime;
62 static TimeValue PosixZeroTime() {
63 return TimeValue ( PosixZeroTimeSeconds,0 );
64 }
5765
5866 /// A constant TimeValue for the Win32 base time which is
5967 /// 00:00:00 (midnight) January 1st, 1601.
6068 /// @brief 00:00:00 Jan 1, 1601 UTC.
61 static const TimeValue Win32ZeroTime;
69 static TimeValue Win32ZeroTime() {
70 return TimeValue ( Win32ZeroTimeSeconds,0 );
71 }
6272
6373 /// @}
6474 /// @name Types
2020 TimeValue::PosixZeroTimeSeconds = -946684800;
2121 const TimeValue::SecondsType
2222 TimeValue::Win32ZeroTimeSeconds = -12591158400ULL;
23
24 const TimeValue TimeValue::MinTime = TimeValue ( INT64_MIN,0 );
25 const TimeValue TimeValue::MaxTime = TimeValue ( INT64_MAX,0 );
26 const TimeValue TimeValue::ZeroTime = TimeValue ( 0,0 );
27 const TimeValue TimeValue::PosixZeroTime = TimeValue ( PosixZeroTimeSeconds,0 );
28 const TimeValue TimeValue::Win32ZeroTime = TimeValue ( Win32ZeroTimeSeconds,0 );
2923
3024 void
3125 TimeValue::normalize( void ) {
4040 // errors concern the timezone parameter which we're passing in as 0.
4141 // In the unlikely case it does happen, just return MinTime, no error
4242 // message needed.
43 return MinTime;
43 return MinTime();
4444 }
4545
4646 return TimeValue(
3030
3131 EXPECT_LT(1u, process::get_self()->page_size());
3232
33 EXPECT_LT(TimeValue::MinTime, process::get_self()->get_user_time());
34 EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_user_time());
35 EXPECT_LT(TimeValue::MinTime, process::get_self()->get_system_time());
36 EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_system_time());
37 EXPECT_LT(TimeValue::MinTime, process::get_self()->get_wall_time());
38 EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_wall_time());
33 EXPECT_LT(TimeValue::MinTime(), process::get_self()->get_user_time());
34 EXPECT_GT(TimeValue::MaxTime(), process::get_self()->get_user_time());
35 EXPECT_LT(TimeValue::MinTime(), process::get_self()->get_system_time());
36 EXPECT_GT(TimeValue::MaxTime(), process::get_self()->get_system_time());
37 EXPECT_LT(TimeValue::MinTime(), process::get_self()->get_wall_time());
38 EXPECT_GT(TimeValue::MaxTime(), process::get_self()->get_wall_time());
3939 }
4040
4141 TEST(ProcessTest, GetRandomNumberTest) {