File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,9 @@ int64_t GetTime()
2020{
2121 if (nMockTime) return nMockTime;
2222
23- return time (NULL );
23+ time_t now = time (NULL );
24+ assert (now > 0 );
25+ return now;
2426}
2527
2628void SetMockTime (int64_t nMockTimeIn)
@@ -30,14 +32,18 @@ void SetMockTime(int64_t nMockTimeIn)
3032
3133int64_t GetTimeMillis ()
3234{
33- return (boost::posix_time::microsec_clock::universal_time () -
34- boost::posix_time::ptime (boost::gregorian::date (1970 ,1 ,1 ))).total_milliseconds ();
35+ int64_t now = (boost::posix_time::microsec_clock::universal_time () -
36+ boost::posix_time::ptime (boost::gregorian::date (1970 ,1 ,1 ))).total_milliseconds ();
37+ assert (now > 0 );
38+ return now;
3539}
3640
3741int64_t GetTimeMicros ()
3842{
39- return (boost::posix_time::microsec_clock::universal_time () -
40- boost::posix_time::ptime (boost::gregorian::date (1970 ,1 ,1 ))).total_microseconds ();
43+ int64_t now = (boost::posix_time::microsec_clock::universal_time () -
44+ boost::posix_time::ptime (boost::gregorian::date (1970 ,1 ,1 ))).total_microseconds ();
45+ assert (now > 0 );
46+ return now;
4147}
4248
4349/* * Return a time useful for the debug log */
You can’t perform that action at this time.
0 commit comments