diff --git a/CorrelationVector/include/correlation_vector/spin_parameters.h b/CorrelationVector/include/correlation_vector/spin_parameters.h index 5e0c364..06f9a25 100644 --- a/CorrelationVector/include/correlation_vector/spin_parameters.h +++ b/CorrelationVector/include/correlation_vector/spin_parameters.h @@ -12,14 +12,14 @@ enum class spin_counter_interval /** The coarse interval drops the 24 least significant bits in time_since_epoch resulting in a counter that increments every 1.67 - seconds. + seconds (on system with 10 million ticks = 1 second). */ coarse = 24, /** The fine interval drops the 16 least significant bits in time_since_epoch resulting in a counter that increments every 6.5 - milliseconds. + milliseconds (on system with 10 million ticks = 1 second). */ fine = 16 }; diff --git a/CorrelationVector/src/guid.cpp b/CorrelationVector/src/guid.cpp index 900476c..b0ded38 100644 --- a/CorrelationVector/src/guid.cpp +++ b/CorrelationVector/src/guid.cpp @@ -38,13 +38,13 @@ constexpr std::array convert_to_array(const unsigned char* g) } #ifdef GUID_WINDOWS -constexpr std::array convert_to_array(const GUID& g) +std::array convert_to_array(const GUID& g) { return impl::convert_to_array(reinterpret_cast(&g)); } #endif #ifdef GUID_LIBUUID -constexpr std::array convert_to_array(const uuid_t& g) +std::array convert_to_array(const uuid_t& g) { return impl::convert_to_array(reinterpret_cast(g)); } diff --git a/CorrelationVector/tests/CorrelationVectorTests.cpp b/CorrelationVector/tests/CorrelationVectorTests.cpp index 8636034..a948a15 100644 --- a/CorrelationVector/tests/CorrelationVectorTests.cpp +++ b/CorrelationVector/tests/CorrelationVectorTests.cpp @@ -294,8 +294,17 @@ TEST_CASE("Spin_SortValidation") lastSpinValue = spinValue; + // MacOS SYSTEM_CLOCK and std::chrono::system_clock have microsecond precision. + // Both Windows and Linux have sub-microsecond precision. + // This means we need to wait a bit longer (over 65 milliseconds) on MacOS + // for the spin operator to change the value of the cV. +#ifdef __APPLE__ + // Wait for 70ms + std::this_thread::sleep_for(std::chrono::milliseconds(70)); +#else // Wait for 10ms. std::this_thread::sleep_for(std::chrono::milliseconds(10)); +#endif } // The counter should wrap at most 1 time.