aboutsummaryrefslogtreecommitdiff
path: root/src/utiltime.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2017-01-19 13:01:18 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2017-01-25 09:48:14 -0500
commit99464bc38e9575ff47f8e33223b252dcea2055e3 (patch)
tree8b01122ab862afac1470e86d0a780780329250d7 /src/utiltime.cpp
parent054d664215ca8d5f17d8aadbfc5b78a8dcd5115c (diff)
downloadbitcoin-99464bc38e9575ff47f8e33223b252dcea2055e3.tar.xz
net: Consistently use GetTimeMicros() for inactivity checks
The use of mocktime in test logic means that comparisons between GetTime() and GetTimeMicros()/1000000 are unreliable since the former can use mocktime values while the latter always gets the system clock; this changes the networking code's inactivity checks to consistently use the system clock for inactivity comparisons. Also remove some hacks from setmocktime() that are no longer needed, now that we're using the system clock for nLastSend and nLastRecv.
Diffstat (limited to 'src/utiltime.cpp')
-rw-r--r--src/utiltime.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utiltime.cpp b/src/utiltime.cpp
index 7c5ee77265..87a25866e9 100644
--- a/src/utiltime.cpp
+++ b/src/utiltime.cpp
@@ -46,6 +46,11 @@ int64_t GetTimeMicros()
return now;
}
+int64_t GetSystemTimeInSeconds()
+{
+ return GetTimeMicros()/1000000;
+}
+
/** Return a time useful for the debug log */
int64_t GetLogTimeMicros()
{