diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-01-26 09:57:01 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-01-26 09:57:45 +0100 |
commit | 3f9f9629cc1e4d9490dc13615114760e1889d5c6 (patch) | |
tree | 9fc9c71487eb4414e82183f82a200e8bd7bc842a /src/utiltime.h | |
parent | f89502306dcf6393a2c7b0efbb0fa728fc582137 (diff) | |
parent | 99464bc38e9575ff47f8e33223b252dcea2055e3 (diff) |
Merge #9606: net: Consistently use GetTimeMicros() for inactivity checks
99464bc net: Consistently use GetTimeMicros() for inactivity checks (Suhas Daftuar)
Diffstat (limited to 'src/utiltime.h')
-rw-r--r-- | src/utiltime.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utiltime.h b/src/utiltime.h index b2807267db..05c6790495 100644 --- a/src/utiltime.h +++ b/src/utiltime.h @@ -9,9 +9,20 @@ #include <stdint.h> #include <string> +/** + * GetTimeMicros() and GetTimeMillis() both return the system time, but in + * different units. GetTime() returns the sytem time in seconds, but also + * supports mocktime, where the time can be specified by the user, eg for + * testing (eg with the setmocktime rpc, or -mocktime argument). + * + * TODO: Rework these functions to be type-safe (so that we don't inadvertently + * compare numbers with different units, or compare a mocktime to system time). + */ + int64_t GetTime(); int64_t GetTimeMillis(); int64_t GetTimeMicros(); +int64_t GetSystemTimeInSeconds(); // Like GetTime(), but not mockable int64_t GetLogTimeMicros(); void SetMockTime(int64_t nMockTimeIn); void MilliSleep(int64_t n); |