aboutsummaryrefslogtreecommitdiff
path: root/src/utiltime.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utiltime.h')
-rw-r--r--src/utiltime.h11
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);