From dd3a34d674ec532b750b7164dbc8c0612da7bfb8 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 1 Sep 2023 12:22:27 +0200 Subject: [PATCH] Remove unused (I)Timer methods --- include/ITimer.h | 35 ------------------------ include/SIrrCreationParameters.h | 9 ------- source/Irrlicht/CIrrDeviceStub.cpp | 2 +- source/Irrlicht/CTimer.h | 10 ++----- source/Irrlicht/os.cpp | 43 ++++-------------------------- source/Irrlicht/os.h | 5 +--- 6 files changed, 9 insertions(+), 95 deletions(-) diff --git a/include/ITimer.h b/include/ITimer.h index 709db975..65958e23 100644 --- a/include/ITimer.h +++ b/include/ITimer.h @@ -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 diff --git a/include/SIrrCreationParameters.h b/include/SIrrCreationParameters.h index 1ac150bb..f57058ae 100644 --- a/include/SIrrCreationParameters.h +++ b/include/SIrrCreationParameters.h @@ -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. */ diff --git a/source/Irrlicht/CIrrDeviceStub.cpp b/source/Irrlicht/CIrrDeviceStub.cpp index 647257c7..2ac7d51f 100644 --- a/source/Irrlicht/CIrrDeviceStub.cpp +++ b/source/Irrlicht/CIrrDeviceStub.cpp @@ -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(); diff --git a/source/Irrlicht/CTimer.h b/source/Irrlicht/CTimer.h index 7dd66075..b1e4f74a 100644 --- a/source/Irrlicht/CTimer.h +++ b/source/Irrlicht/CTimer.h @@ -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 diff --git a/source/Irrlicht/os.cpp b/source/Irrlicht/os.cpp index cdd1a26c..eea8efdc 100644 --- a/source/Irrlicht/os.cpp +++ b/source/Irrlicht/os.cpp @@ -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 #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() { diff --git a/source/Irrlicht/os.h b/source/Irrlicht/os.h index 3db0b749..3e6343f7 100644 --- a/source/Irrlicht/os.h +++ b/source/Irrlicht/os.h @@ -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);