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()
20
20
{
21
21
if (nMockTime) return nMockTime;
22
22
23
- return time (NULL );
23
+ time_t now = time (NULL );
24
+ assert (now > 0 );
25
+ return now;
24
26
}
25
27
26
28
void SetMockTime (int64_t nMockTimeIn)
@@ -30,14 +32,18 @@ void SetMockTime(int64_t nMockTimeIn)
30
32
31
33
int64_t GetTimeMillis ()
32
34
{
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;
35
39
}
36
40
37
41
int64_t GetTimeMicros ()
38
42
{
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;
41
47
}
42
48
43
49
/* * Return a time useful for the debug log */
You can’t perform that action at this time.
0 commit comments