Remove unused (I)Timer methods

This commit is contained in:
sfan5 2023-09-01 12:22:27 +02:00
parent 0735220f86
commit dd3a34d674
6 changed files with 9 additions and 95 deletions

View File

@ -21,41 +21,6 @@ public:
*/
virtual u32 getRealTime() const = 0;
enum EWeekday
{
EWD_SUNDAY=0,
EWD_MONDAY,
EWD_TUESDAY,
EWD_WEDNESDAY,
EWD_THURSDAY,
EWD_FRIDAY,
EWD_SATURDAY
};
struct RealTimeDate
{
// Hour of the day, from 0 to 23
u32 Hour;
// Minute of the hour, from 0 to 59
u32 Minute;
// Second of the minute, due to extra seconds from 0 to 61
u32 Second;
// Year of the Gregorian calender
s32 Year;
// Month of the year, from 1 to 12
u32 Month;
// Day of the month, from 1 to 31
u32 Day;
// Weekday for the current day
EWeekday Weekday;
// Day of the year, from 1 to 366
u32 Yearday;
// Whether daylight saving is on
bool IsDST;
};
virtual RealTimeDate getRealTimeAndDate() const = 0;
//! Returns current virtual time in milliseconds.
/** This value starts with 0 and can be manipulated using setTime(),
stopTimer(), startTimer(), etc. This value depends on the set speed of

View File

@ -50,7 +50,6 @@ namespace irr
#endif
DisplayAdapter(0),
DriverMultithreaded(false),
UsePerformanceTimer(true),
SDK_version_do_not_use(IRRLICHT_SDK_VERSION),
PrivateData(0),
#ifdef IRR_MOBILE_PATHS
@ -90,7 +89,6 @@ namespace irr
LoggingLevel = other.LoggingLevel;
DisplayAdapter = other.DisplayAdapter;
DriverMultithreaded = other.DriverMultithreaded;
UsePerformanceTimer = other.UsePerformanceTimer;
PrivateData = other.PrivateData;
OGLES2ShaderPath = other.OGLES2ShaderPath;
return *this;
@ -302,13 +300,6 @@ namespace irr
So far only supported on D3D. */
bool DriverMultithreaded;
//! Enables use of high performance timers on Windows platform.
/** When performance timers are not used, standard GetTickCount()
is used instead which usually has worse resolution, but also less
problems with speed stepping and other techniques.
*/
bool UsePerformanceTimer;
//! Don't use or change this parameter.
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
This is needed for sdk version checks. */

View File

@ -24,7 +24,7 @@ CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
InputReceivingSceneManager(0), ContextManager(0),
CreationParams(params), Close(false)
{
Timer = new CTimer(params.UsePerformanceTimer);
Timer = new CTimer();
if (os::Printer::Logger)
{
os::Printer::Logger->grab();

View File

@ -14,9 +14,9 @@ namespace irr
{
public:
CTimer(bool usePerformanceTimer=true)
CTimer()
{
os::Timer::initTimer(usePerformanceTimer);
os::Timer::initTimer();
}
//! Returns current real time in milliseconds of the system.
@ -28,12 +28,6 @@ namespace irr
return os::Timer::getRealTime();
}
//! Get current time and date in calendar form
RealTimeDate getRealTimeAndDate() const override
{
return os::Timer::getRealTimeAndDate();
}
//! Returns current virtual time in milliseconds.
/** This value starts with 0 and can be manipulated using setTime(), stopTimer(),
startTimer(), etc. This value depends on the set speed of the timer if the timer

View File

@ -16,7 +16,6 @@
#define bswap_16(X) _byteswap_ushort(X)
#define bswap_32(X) _byteswap_ulong(X)
#define bswap_64(X) _byteswap_uint64(X)
#define localtime _localtime_s
#elif defined(_IRR_OSX_PLATFORM_)
#include <libkern/OSByteOrder.h>
#define bswap_16(X) OSReadSwapInt16(&X,0)
@ -82,12 +81,9 @@ namespace os
static LARGE_INTEGER HighPerformanceFreq;
static BOOL HighPerformanceTimerSupport = FALSE;
void Timer::initTimer(bool usePerformanceTimer)
void Timer::initTimer()
{
if (usePerformanceTimer)
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
else
HighPerformanceTimerSupport = FALSE;
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
initVirtualTimer();
}
@ -158,7 +154,7 @@ namespace os
__android_log_print(LogLevel, "Irrlicht", "%s\n", &message[start]);
}
void Timer::initTimer(bool usePerformanceTimer)
void Timer::initTimer()
{
initVirtualTimer();
}
@ -211,7 +207,7 @@ namespace os
emscripten_log(log_level, "%s", message); // Note: not adding \n as emscripten_log seems to do that already.
}
void Timer::initTimer(bool usePerformanceTimer)
void Timer::initTimer()
{
initVirtualTimer();
}
@ -244,7 +240,7 @@ namespace os
printf("%s\n", message);
}
void Timer::initTimer(bool usePerformanceTimer)
void Timer::initTimer()
{
initVirtualTimer();
}
@ -297,35 +293,6 @@ namespace os
u32 Timer::StartRealTime = 0;
u32 Timer::StaticTime = 0;
//! Get real time and date in calendar form
ITimer::RealTimeDate Timer::getRealTimeAndDate()
{
time_t rawtime;
time(&rawtime);
struct tm * timeinfo;
timeinfo = localtime(&rawtime);
// init with all 0 to indicate error
ITimer::RealTimeDate date;
memset(&date, 0, sizeof(date));
// at least Windows returns NULL on some illegal dates
if (timeinfo)
{
// set useful values if succeeded
date.Hour=(u32)timeinfo->tm_hour;
date.Minute=(u32)timeinfo->tm_min;
date.Second=(u32)timeinfo->tm_sec;
date.Day=(u32)timeinfo->tm_mday;
date.Month=(u32)timeinfo->tm_mon+1;
date.Year=(u32)timeinfo->tm_year+1900;
date.Weekday=(ITimer::EWeekday)timeinfo->tm_wday;
date.Yearday=(u32)timeinfo->tm_yday+1;
date.IsDST=timeinfo->tm_isdst != 0;
}
return date;
}
//! returns current virtual time
u32 Timer::getTime()
{

View File

@ -51,11 +51,8 @@ namespace os
//! returns the current time in milliseconds
static u32 getTime();
//! get current time and date in calendar form
static ITimer::RealTimeDate getRealTimeAndDate();
//! initializes the real timer
static void initTimer(bool usePerformanceTimer=true);
static void initTimer();
//! sets the current virtual (game) time
static void setTime(u32 time);