*******************************************************************************/
-#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
// 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;
return ts.tv_sec;
}
-static const time_t reference = setReference();
+static const time_t reference = setReference_();
-scalar ticks()
+Scalar getTicks()
{
struct timespec ts;
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;
}
#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
{
}
-} // namespace dc
+} // namespace Mf
/** vim: set ts=4 sw=4 tw=80: *************************************************/