Add STATIC_NONCE option for build (developper mode)

This commit is contained in:
Grégory Soutadé 2022-08-07 16:45:59 +02:00
parent 210b265693
commit 57c3a58994
2 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,10 @@ else
CXXFLAGS += -O2 CXXFLAGS += -O2
endif endif
ifneq ($(STATIC_NONCE),)
CXXFLAGS += -DSTATIC_NONCE=1
endif
SRCDIR := src SRCDIR := src
INCDIR := inc INCDIR := inc
BUILDDIR := obj BUILDDIR := obj

View File

@ -282,7 +282,11 @@ namespace gourou
struct timeval tv; struct timeval tv;
gettimeofday(&tv, 0); gettimeofday(&tv, 0);
uint32_t nonce32[2] = {0x6f046000, 0x388a}; uint32_t nonce32[2] = {0x6f046000, 0x388a};
#ifdef STATIC_NONCE
uint64_t bigtime = 0xAA001122BBCCAAULL;
#else
uint64_t bigtime = tv.tv_sec*1000; uint64_t bigtime = tv.tv_sec*1000;
#endif
nonce32[0] += (bigtime & 0xFFFFFFFF) + (tv.tv_usec/1000); nonce32[0] += (bigtime & 0xFFFFFFFF) + (tv.tv_usec/1000);
nonce32[1] += ((bigtime >> 32) & 0xFFFFFFFF); nonce32[1] += ((bigtime >> 32) & 0xFFFFFFFF);