diff --git a/include/Spectre/Math/Time.h b/include/Spectre/Math/Time.h index 9abb7d3..a2753c5 100644 --- a/include/Spectre/Math/Time.h +++ b/include/Spectre/Math/Time.h @@ -23,8 +23,8 @@ public : private : - // In microseconds. - long m_value; + // Microseconds (us) + long m_us; }; // ---------------------------- diff --git a/source/Math/Time.cpp b/source/Math/Time.cpp index 2e62b4c..f380817 100644 --- a/source/Math/Time.cpp +++ b/source/Math/Time.cpp @@ -5,23 +5,27 @@ namespace sp { Time::Time(long value) : -m_value(value) +m_us(value) { } double Time::seconds() const { - return ((double) m_value) / 1000000.0f; + // Faster way of calling milliseconds() / 1000 as + // ms = us / 1000 + // s = ms / 1000 = us / 1000 / 1000 = us / 10000000 + return ((double) m_us) / 1000000.0f; } int Time::milliseconds() const { - return ((double) m_value) / 1000; + // ms = us / 1000 + return ((double) m_us) / 1000; } long Time::microseconds() const { - return m_value; + return m_us; } // ----------------------------