From 57c3a5899436ac3ef3b1761962d2820725c4a66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 7 Aug 2022 16:45:59 +0200 Subject: [PATCH] Add STATIC_NONCE option for build (developper mode) --- Makefile | 4 ++++ src/libgourou.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 329341e..3637eac 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,10 @@ else CXXFLAGS += -O2 endif +ifneq ($(STATIC_NONCE),) +CXXFLAGS += -DSTATIC_NONCE=1 +endif + SRCDIR := src INCDIR := inc BUILDDIR := obj diff --git a/src/libgourou.cpp b/src/libgourou.cpp index 148e8af..cdae6a7 100644 --- a/src/libgourou.cpp +++ b/src/libgourou.cpp @@ -282,7 +282,11 @@ namespace gourou struct timeval tv; gettimeofday(&tv, 0); uint32_t nonce32[2] = {0x6f046000, 0x388a}; +#ifdef STATIC_NONCE + uint64_t bigtime = 0xAA001122BBCCAAULL; +#else uint64_t bigtime = tv.tv_sec*1000; +#endif nonce32[0] += (bigtime & 0xFFFFFFFF) + (tv.tv_usec/1000); nonce32[1] += ((bigtime >> 32) & 0xFFFFFFFF);