Fixed some transforms, move to 3d and quaternion math in progress...
[ne.git] / src / base / time.cpp
blob85fede77875a841b496b1e7e5d4bd0ba17b99616
1 #include "time.h"
3 //using namespace Base;
5 #ifdef WIN32
6 #include <windows.h>
7 #else
8 #include <sys/time.h>
9 #include <time.h>
10 #endif
12 Time::Stamp Time::Now()
14 long time;
15 #ifdef WIN32
16 time = timeGetTime();
17 #else
18 static timeval tp;
19 gettimeofday(&tp, 0);
20 time = tp.tv_sec * 1000 + tp.tv_usec * 0.001;
21 #endif
22 return time;
26 void Time::Sleep(unsigned int millisecs)
28 #ifdef WIN32
29 Sleep(millisecs);
30 #else
31 struct timespec req, rem;
32 req.tv_sec = 0;
33 req.tv_nsec = millisecs * 1000000;
34 if (nanosleep(&req, &rem) == -1)
35 nanosleep(&rem, 0);
36 #endif