mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Moved #ifdef LOVE_WINDOWS to Timer.cpp.
This commit is contained in:
@@ -18,6 +18,15 @@
|
|||||||
* 3. This notice may not be removed or altered from any source distribution.
|
* 3. This notice may not be removed or altered from any source distribution.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#include <common/config.h>
|
||||||
|
|
||||||
|
#ifdef LOVE_WINDOWS
|
||||||
|
# include <windows.h>
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
@@ -92,18 +101,21 @@ namespace sdl
|
|||||||
|
|
||||||
float Timer::getMicroTime() const
|
float Timer::getMicroTime() const
|
||||||
{
|
{
|
||||||
#ifdef LOVE_WINDOWS
|
#ifdef LOVE_WINDOWS
|
||||||
|
/*
|
||||||
long ticks, freq;
|
long ticks, freq;
|
||||||
QueryPeformanceCounter(&ticks);
|
QueryPeformanceCounter(&ticks);
|
||||||
QueryPeformanceFrequency(&freq);
|
QueryPeformanceFrequency(&freq);
|
||||||
long secs = ticks/freq;
|
long secs = ticks/freq;
|
||||||
long usecs = (ticks%freq)/(freq/1000000.0f);
|
long usecs = (ticks%freq)/(freq/1000000.0f);
|
||||||
return secs%86400 + usecs/1000000.0f;
|
return secs%86400 + usecs/1000000.0f;
|
||||||
#else
|
*/
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
timeval t;
|
timeval t;
|
||||||
gettimeofday(&t, NULL);
|
gettimeofday(&t, NULL);
|
||||||
return t.tv_sec%86400 + t.tv_usec/1000000.0f;
|
return t.tv_sec%86400 + t.tv_usec/1000000.0f;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // sdl
|
} // sdl
|
||||||
|
|||||||
@@ -24,12 +24,6 @@
|
|||||||
// SDL
|
// SDL
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#ifdef LOVE_WINDOWS
|
|
||||||
#include <time.h>
|
|
||||||
#else
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// LOVE
|
// LOVE
|
||||||
#include <common/Module.h>
|
#include <common/Module.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user