mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
SetMockTime() for cleaner unit testing
This commit is contained in:
parent
700f942692
commit
54d02f158d
2 changed files with 10 additions and 0 deletions
|
|
@ -815,11 +815,20 @@ void ShrinkDebugFile()
|
|||
// - Median of other nodes's clocks
|
||||
// - The user (asking the user to fix the system clock if the first two disagree)
|
||||
//
|
||||
static int64 nMockTime = 0; // For unit testing
|
||||
|
||||
int64 GetTime()
|
||||
{
|
||||
if (nMockTime) return nMockTime;
|
||||
|
||||
return time(NULL);
|
||||
}
|
||||
|
||||
void SetMockTime(int64 nMockTimeIn)
|
||||
{
|
||||
nMockTime = nMockTimeIn;
|
||||
}
|
||||
|
||||
static int64 nTimeOffset = 0;
|
||||
|
||||
int64 GetAdjustedTime()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue