diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h index 294895f7f..59e47c457 100644 --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -653,8 +653,7 @@ class Time */ static inline Resolution* PeekResolution() { - static Time::Resolution& resolution{SetDefaultNsResolution()}; - return &resolution; + return &m_resolution; } /** @@ -832,7 +831,8 @@ class Time friend Time& operator-=(Time& lhs, const Time& rhs); /**@}*/ // Compound assignment - int64_t m_data; //!< Virtual time value, in the current unit. + int64_t m_data; //!< Virtual time value, in the current unit. + static Time::Resolution m_resolution; //!< The current time resolution }; // class Time diff --git a/src/core/model/time.cc b/src/core/model/time.cc index 32a0f9446..4d93ad8d3 100644 --- a/src/core/model/time.cc +++ b/src/core/model/time.cc @@ -91,6 +91,9 @@ Time::MarkedTimes* Time::g_markingTimes = nullptr; /// The static mutex for critical sections around modification of Time::g_markingTimes. static std::mutex g_markingMutex; +// The resolution of the Time class +Time::Resolution Time::m_resolution{SetDefaultNsResolution()}; + // Function called to force static initialization // static bool