summaryrefslogtreecommitdiff
path: root/src/KM_util.cpp
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-03-16 22:03:56 +0100
committerCarl Hetherington <cth@carlh.net>2024-03-21 20:29:50 +0100
commit067ac061ce1ade925d64a7c411403455e97d1c38 (patch)
tree4bc30038195fa9a8a0c7b2f4987664ca2eeb9ea8 /src/KM_util.cpp
parent4898f9d60bc621cb464faa00fb50146495d76928 (diff)
Add hacks for predictable random number and timestamp generation.
Diffstat (limited to 'src/KM_util.cpp')
-rwxr-xr-xsrc/KM_util.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/KM_util.cpp b/src/KM_util.cpp
index 4c59c78..804abcb 100755
--- a/src/KM_util.cpp
+++ b/src/KM_util.cpp
@@ -40,6 +40,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <string>
+bool Kumu::dcpomatic_test = false;
+
const char*
Kumu::Version()
{
@@ -593,6 +595,13 @@ Kumu::GenRandomValue(UUID& ID)
ID.Set(tmp_buf);
}
+void
+Kumu::ResetTestRNG()
+{
+ FortunaRNG RNG;
+ RNG.Reset();
+}
+
//
void
Kumu::GenRandomUUID(byte_t* buf)
@@ -749,7 +758,14 @@ Kumu::write_BER(byte_t* buf, ui64_t val, ui32_t ber_len)
//
Kumu::Timestamp::Timestamp() : m_TZOffsetMinutes(0) {
- m_Timestamp.now();
+ if (dcpomatic_test)
+ {
+ m_Timestamp.x = 42;
+ }
+ else
+ {
+ m_Timestamp.now();
+ }
}
Kumu::Timestamp::Timestamp(const Timestamp& rhs) {