]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Timer.cc
extreme refactoring
[chaz/yoink] / src / Moof / Timer.cc
similarity index 86%
rename from src/timer.cc
rename to src/Moof/Timer.cc
index d73d94f1bbedb7d11c0d9bc76a558a316d26d05c..4eea488ad7f43d29af7280f63ea3371f2380f4b2 100644 (file)
 
 *******************************************************************************/
 
-#include <stdexcept>
-#include <ctime>
 #include <cerrno>
+#include <ctime>
+#include <stdexcept>
+
+#include "Timer.hh"
 
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include "timer.hh"
-
 
-namespace dc {
+namespace Mf {
 
 
 #if HAVE_CLOCK_GETTIME
@@ -49,7 +49,7 @@ namespace dc {
 // program starts).  Of course this isn't much of an issue if scalar is a
 // double-precision number.
 
-static time_t setReference()
+static time_t setReference_()
 {
        struct timespec ts;
 
@@ -61,10 +61,10 @@ static time_t setReference()
        return ts.tv_sec;
 }
 
-static const time_t reference = setReference();
+static const time_t reference = setReference_();
 
 
-scalar ticks()
+Scalar getTicks()
 {
        struct timespec ts;
 
@@ -73,7 +73,7 @@ scalar ticks()
                throw std::runtime_error("cannot access monotonic clock");
        }
 
-       return scalar(ts.tv_sec - reference) + scalar(ts.tv_nsec) / 1000000000.0;
+       return Scalar(ts.tv_sec - reference) + Scalar(ts.tv_nsec) / 1000000000.0;
 }
 
 
@@ -86,24 +86,24 @@ scalar ticks()
 
 #include <SDL/SDL.h>
 
-scalar ticks()
+Scalar getTicks()
 {
        Uint32 ms = SDL_GetTicks();
-       return scalar(ms / 1000) + scalar(ms % 1000) / 1000.0;
+       return Scalar(ms / 1000) + Scalar(ms % 1000) / 1000.0;
 }
 
 
 #endif // HAVE_CLOCK_GETTIME
 
 
-void sleep(scalar seconds, bool absolute)
+void sleep(Scalar seconds, bool absolute)
 {
        struct timespec ts;
        int ret;
 
-       if (absolute) seconds -= ticks();
+       if (absolute) seconds -= getTicks();
        ts.tv_sec = time_t(seconds);
-       ts.tv_nsec = long((seconds - scalar(ts.tv_sec)) * 1000000000.0);
+       ts.tv_nsec = long((seconds - Scalar(ts.tv_sec)) * 1000000000.0);
 
        do
        {
@@ -113,7 +113,7 @@ void sleep(scalar seconds, bool absolute)
 }
 
 
-} // namespace dc
+} // namespace Mf
 
 /** vim: set ts=4 sw=4 tw=80: *************************************************/
 
This page took 0.01906 seconds and 4 git commands to generate.