From 8ac54800a8af92c3075163c1094909fd3ce42ab7 Mon Sep 17 00:00:00 2001 From: skyjake Date: Tue, 13 Nov 2012 17:06:40 +0200 Subject: [PATCH] Refactor: Moved the timer module to libdeng, renamed API functions The timer module's public functions are now named according to modern practices. --- doomsday/engine/api/dd_share.h | 4 - doomsday/engine/api/doomsday.def | 6 +- doomsday/engine/api/doomsday.h | 4 - doomsday/engine/engine.pro | 2 - doomsday/engine/include/de_system.h | 2 +- doomsday/engine/include/m_profiler.h | 6 +- doomsday/engine/include/timer.h | 44 --------- doomsday/engine/src/audio/s_cache.c | 4 +- doomsday/engine/src/audio/s_environ.cpp | 4 +- doomsday/engine/src/audio/s_logic.c | 8 +- doomsday/engine/src/audio/s_sfx.c | 4 +- doomsday/engine/src/audio/sys_audiod_dummy.c | 4 +- .../engine/src/audio/sys_audiod_sdlmixer.c | 4 +- doomsday/engine/src/busymode.cpp | 4 +- doomsday/engine/src/client/cl_main.c | 2 +- doomsday/engine/src/client/cl_mobj.c | 10 +-- doomsday/engine/src/con_bar.c | 6 +- doomsday/engine/src/dd_help.c | 4 +- doomsday/engine/src/dd_loop.c | 14 +-- doomsday/engine/src/dd_main.cpp | 8 +- doomsday/engine/src/def_main.cpp | 4 +- doomsday/engine/src/edit_bias.c | 2 +- doomsday/engine/src/edit_map.cpp | 4 +- doomsday/engine/src/gl_defer.c | 4 +- doomsday/engine/src/map/dam_main.cpp | 4 +- doomsday/engine/src/map/gamemap.c | 4 +- doomsday/engine/src/map/p_mobj.c | 2 +- doomsday/engine/src/map/p_particle.c | 4 +- doomsday/engine/src/network/net_buf.c | 4 +- doomsday/engine/src/network/net_main.c | 6 +- doomsday/engine/src/network/net_ping.c | 4 +- doomsday/engine/src/network/sys_network.c | 2 +- doomsday/engine/src/r_things.c | 8 +- doomsday/engine/src/r_world.c | 4 +- doomsday/engine/src/render/r_fakeradio.c | 4 +- doomsday/engine/src/render/r_lgrid.c | 4 +- doomsday/engine/src/render/rend_bias.c | 6 +- doomsday/engine/src/resource/models.cpp | 4 +- doomsday/engine/src/resource/r_data.c | 12 +-- doomsday/engine/src/resourcenamespace.cpp | 4 +- doomsday/engine/src/server/sv_main.c | 8 +- doomsday/engine/src/server/sv_pool.c | 7 +- doomsday/engine/src/sys_system.c | 12 +-- doomsday/engine/src/ui/b_device.c | 2 +- doomsday/engine/src/ui/busyvisual.c | 10 +-- doomsday/engine/src/ui/dd_input.c | 6 +- doomsday/engine/src/ui/p_control.c | 2 +- doomsday/libdeng/include/de/timer.h | 90 +++++++++++++++++++ doomsday/libdeng/libdeng.pro | 2 + doomsday/libdeng/src/libdeng.c | 3 + doomsday/{engine => libdeng}/src/timer.cpp | 76 ++++++---------- doomsday/plugins/common/include/common.h | 2 + doomsday/plugins/common/src/g_game.c | 6 +- doomsday/plugins/common/src/p_saveg.c | 2 +- .../directsound/src/driver_directsound.cpp | 4 +- .../plugins/wadmapconverter/src/id1map.cpp | 5 +- .../wadmapconverter/src/id1map_analyze.cpp | 5 +- .../src/id1map_loadblockmap.cpp | 4 +- doomsday/plugins/winmm/src/cdaudio.cpp | 8 +- 59 files changed, 253 insertions(+), 235 deletions(-) delete mode 100644 doomsday/engine/include/timer.h create mode 100644 doomsday/libdeng/include/de/timer.h rename doomsday/{engine => libdeng}/src/timer.cpp (70%) diff --git a/doomsday/engine/api/dd_share.h b/doomsday/engine/api/dd_share.h index 06aec0205d..72f3ede871 100644 --- a/doomsday/engine/api/dd_share.h +++ b/doomsday/engine/api/dd_share.h @@ -1144,10 +1144,6 @@ typedef struct povertex_s { // //------------------------------------------------------------------------ -#define TICRATE 35 // Number of tics / second. -#define TICSPERSEC 35 -#define SECONDSPERTIC (1.0f/TICSPERSEC) - #define SCREENWIDTH 320 #define SCREENHEIGHT 200 diff --git a/doomsday/engine/api/doomsday.def b/doomsday/engine/api/doomsday.def index a2b4c30320..991f5ecaf6 100644 --- a/doomsday/engine/api/doomsday.def +++ b/doomsday/engine/api/doomsday.def @@ -422,9 +422,9 @@ EXPORTS B_SetContextFallback @440 NONAME ; System. ; Sys_TicksPerSecond @46 NONAME - Sys_GetTime @47 NONAME - Sys_GetSeconds @48 NONAME - Sys_GetRealTime @49 NONAME +; Sys_GetTime @47 NONAME +; Sys_GetSeconds @48 NONAME +; Timer_RealMilliseconds @49 NONAME Sys_Sleep @50 NONAME Sys_CriticalMessage @51 NONAME Sys_Quit @52 NONAME diff --git a/doomsday/engine/api/doomsday.h b/doomsday/engine/api/doomsday.h index 4549597c13..1b25b34bc5 100644 --- a/doomsday/engine/api/doomsday.h +++ b/doomsday/engine/api/doomsday.h @@ -303,10 +303,6 @@ int DD_Executef(int silent, char const* command, ...); * Functionality provided by or related to the operating system. */ ///@{ - void Sys_TicksPerSecond(float num); - int Sys_GetTime(void); - double Sys_GetSeconds(void); - uint Sys_GetRealTime(void); void Sys_Sleep(int millisecs); int Sys_CriticalMessage(char* msg); void Sys_Quit(void); diff --git a/doomsday/engine/engine.pro b/doomsday/engine/engine.pro index 211fa77e93..957a4cb090 100644 --- a/doomsday/engine/engine.pro +++ b/doomsday/engine/engine.pro @@ -323,7 +323,6 @@ DENG_HEADERS += \ include/sys_system.h \ include/tab_anorms.h \ include/texturecontent.h \ - include/timer.h \ include/ui/b_command.h \ include/ui/b_context.h \ include/ui/b_device.h \ @@ -609,7 +608,6 @@ SOURCES += \ src/sys_reslocator.cpp \ src/sys_system.c \ src/tab_tables.c \ - src/timer.cpp \ src/ui/b_command.c \ src/ui/b_context.c \ src/ui/b_device.c \ diff --git a/doomsday/engine/include/de_system.h b/doomsday/engine/include/de_system.h index 37726c1ecf..8262c06a53 100644 --- a/doomsday/engine/include/de_system.h +++ b/doomsday/engine/include/de_system.h @@ -26,13 +26,13 @@ #define LIBDENG_SYSTEM_H #include +#include #include "sys_system.h" #include "sys_console.h" #include "ui/sys_input.h" #include "network/sys_network.h" #include "network/masterserver.h" -#include "timer.h" #include "sys_opengl.h" // Use SDL for window management under *nix diff --git a/doomsday/engine/include/m_profiler.h b/doomsday/engine/include/m_profiler.h index ce5800faa5..d065da897a 100644 --- a/doomsday/engine/include/m_profiler.h +++ b/doomsday/engine/include/m_profiler.h @@ -30,7 +30,7 @@ #define __DOOMSDAY_MISC_PROFILER_H__ #include "dd_types.h" -#include "timer.h" +#include "de/timer.h" /* * This header defines some handy macros for profiling. @@ -47,8 +47,8 @@ typedef struct profiler_s { #ifdef DD_PROFILE // Profiling is enabled. # define END_PROF_TIMERS() ,NUM_PROFS }; static profiler_t profiler_[NUM_PROFS]; -# define BEGIN_PROF(x) (profiler_[x].startCount++, profiler_[x].startTime = Sys_GetRealTime()) -# define END_PROF(x) (profiler_[x].totalTime += Sys_GetRealTime() - profiler_[x].startTime) +# define BEGIN_PROF(x) (profiler_[x].startCount++, profiler_[x].startTime = Timer_RealMilliseconds()) +# define END_PROF(x) (profiler_[x].totalTime += Timer_RealMilliseconds() - profiler_[x].startTime) # define PRINT_PROF(x) Con_Message("[%f ms] " #x ": %i ms (%i starts)\n", \ profiler_[x].startCount? profiler_[x].totalTime / \ (float) profiler_[x].startCount : 0, \ diff --git a/doomsday/engine/include/timer.h b/doomsday/engine/include/timer.h deleted file mode 100644 index 998afd88ee..0000000000 --- a/doomsday/engine/include/timer.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file timer.h - * Timing subsystem. @ingroup system - * - * @authors Copyright © 2003-2012 Jaakko Keränen - * - * @par License - * GPL: http://www.gnu.org/licenses/gpl.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. This program is distributed in the hope that it - * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. You should have received a copy of the GNU - * General Public License along with this program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef __DOOMSDAY_SYSTEM_TIMER_H__ -#define __DOOMSDAY_SYSTEM_TIMER_H__ - -#include "dd_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void Sys_InitTimer(void); -void Sys_ShutdownTimer(void); -int Sys_GetTime(void); -double Sys_GetTimef(void); -double Sys_GetSeconds(void); -uint Sys_GetRealTime(void); -double Sys_GetRealSeconds(void); -void Sys_TicksPerSecond(float num); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/doomsday/engine/src/audio/s_cache.c b/doomsday/engine/src/audio/s_cache.c index a8ea754854..ef60af0eda 100644 --- a/doomsday/engine/src/audio/s_cache.c +++ b/doomsday/engine/src/audio/s_cache.c @@ -441,7 +441,7 @@ void Sfx_PurgeCache(void) int totalSize = 0, maxSize = sfxMaxCacheKB * 1024; sfxcache_t* it, *next, *lowest; - int i, lowHits = 0, nowTime = Sys_GetTime(); + int i, lowHits = 0, nowTime = Timer_Ticks(); if(!sfxAvail) return; @@ -531,7 +531,7 @@ void Sfx_CacheHit(int id) if(node) { node->hits++; - node->lastUsed = Sys_GetTime(); + node->lastUsed = Timer_Ticks(); } } diff --git a/doomsday/engine/src/audio/s_environ.cpp b/doomsday/engine/src/audio/s_environ.cpp index 4d7676a8c9..5534ac2ca4 100644 --- a/doomsday/engine/src/audio/s_environ.cpp +++ b/doomsday/engine/src/audio/s_environ.cpp @@ -201,7 +201,7 @@ static void findBspLeafsAffectingSector(GameMap* map, uint secIDX) void S_DetermineBspLeafsAffectingSectorReverb(GameMap* map) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); /// @todo optimize: Make use of the BSP leaf blockmap. uint numSectors = GameMap_SectorCount(map); @@ -214,7 +214,7 @@ void S_DetermineBspLeafsAffectingSectorReverb(GameMap* map) // How much time did we spend? LOG_VERBOSE("S_DetermineBspLeafsAffectingSectorReverb: Done in %.2f seconds.") - << (Sys_GetRealTime() - startTime) / 1000.0f; + << (Timer_RealMilliseconds() - startTime) / 1000.0f; } static boolean calcBspLeafReverb(BspLeaf* bspLeaf) diff --git a/doomsday/engine/src/audio/s_logic.c b/doomsday/engine/src/audio/s_logic.c index e56b5d6bfd..bdc205dd6c 100644 --- a/doomsday/engine/src/audio/s_logic.c +++ b/doomsday/engine/src/audio/s_logic.c @@ -38,7 +38,7 @@ #include "de_console.h" #include "de_audio.h" -#include "timer.h" +#include "de/timer.h" // MACROS ------------------------------------------------------------------ @@ -163,7 +163,7 @@ void Sfx_StartLogical(int id, mobj_t *origin, boolean isRepeating) node = Sfx_CreateLogical(id); node->origin = origin; node->isRepeating = isRepeating; - node->endTime = Sys_GetRealTime() + length; + node->endTime = Timer_RealMilliseconds() + length; } /* @@ -217,7 +217,7 @@ int Sfx_StopLogical(int id, mobj_t *origin) void Sfx_PurgeLogical(void) { static uint lastTime = 0; - uint i, nowTime = Sys_GetRealTime(); + uint i, nowTime = Timer_RealMilliseconds(); logicsound_t *it, *next; if(nowTime - lastTime < PURGE_INTERVAL) @@ -255,7 +255,7 @@ void Sfx_PurgeLogical(void) */ boolean Sfx_IsPlaying(int id, mobj_t *origin) { - uint nowTime = Sys_GetRealTime(); + uint nowTime = Timer_RealMilliseconds(); logicsound_t *it; int i; diff --git a/doomsday/engine/src/audio/s_sfx.c b/doomsday/engine/src/audio/s_sfx.c index c13aee391e..e3b8506273 100644 --- a/doomsday/engine/src/audio/s_sfx.c +++ b/doomsday/engine/src/audio/s_sfx.c @@ -339,7 +339,7 @@ int Sfx_CountPlaying(int id) float Sfx_Priority(mobj_t* emitter, coord_t* point, float volume, int startTic) { // In five seconds all priority of a sound is gone. - float timeoff = 1000 * (Sys_GetTime() - startTic) / (5.0f * TICSPERSEC); + float timeoff = 1000 * (Timer_Ticks() - startTic) / (5.0f * TICSPERSEC); coord_t* origin; if(!listener || (!emitter && !point)) @@ -678,7 +678,7 @@ int Sfx_StartSound(sfxsample_t* sample, float volume, float freq, } // Calculate the new sound's priority. - nowTime = Sys_GetTime(); + nowTime = Timer_Ticks(); myPrio = Sfx_Priority(emitter, fixedOrigin, volume, nowTime); // Ensure there aren't already too many channels playing this sample. diff --git a/doomsday/engine/src/audio/sys_audiod_dummy.c b/doomsday/engine/src/audio/sys_audiod_dummy.c index c447cb8035..631bc91784 100644 --- a/doomsday/engine/src/audio/sys_audiod_dummy.c +++ b/doomsday/engine/src/audio/sys_audiod_dummy.c @@ -220,7 +220,7 @@ void DS_Dummy_SFX_Play(sfxbuffer_t* buf) if(!(buf->flags & SFXBF_PLAYING)) { // Calculate the end time (milliseconds). - buf->endTime = Sys_GetRealTime() + DS_DummyBufferLength(buf); + buf->endTime = Timer_RealMilliseconds() + DS_DummyBufferLength(buf); } // The buffer is now playing. @@ -250,7 +250,7 @@ void DS_Dummy_SFX_Refresh(sfxbuffer_t* buf) return; // Have we passed the predicted end of sample? - if(!(buf->flags & SFXBF_REPEAT) && Sys_GetRealTime() >= buf->endTime) + if(!(buf->flags & SFXBF_REPEAT) && Timer_RealMilliseconds() >= buf->endTime) { // Time for the sound to stop. DS_Dummy_SFX_Stop(buf); diff --git a/doomsday/engine/src/audio/sys_audiod_sdlmixer.c b/doomsday/engine/src/audio/sys_audiod_sdlmixer.c index 21fb0ad05f..d8fd71aa2e 100644 --- a/doomsday/engine/src/audio/sys_audiod_sdlmixer.c +++ b/doomsday/engine/src/audio/sys_audiod_sdlmixer.c @@ -392,7 +392,7 @@ void DS_SDLMixer_SFX_Play(sfxbuffer_t* buf) Mix_PlayChannel(buf->cursor, buf->ptr, (buf->flags & SFXBF_REPEAT ? -1 : 0)); // Calculate the end time (milliseconds). - buf->endTime = Sys_GetRealTime() + getBufLength(buf); + buf->endTime = Timer_RealMilliseconds() + getBufLength(buf); // The buffer is now playing. buf->flags |= SFXBF_PLAYING; @@ -416,7 +416,7 @@ void DS_SDLMixer_SFX_Refresh(sfxbuffer_t* buf) if(!buf || !buf->sample || !(buf->flags & SFXBF_PLAYING)) return; - nowTime = Sys_GetRealTime(); + nowTime = Timer_RealMilliseconds(); /** * Have we passed the predicted end of sample? diff --git a/doomsday/engine/src/busymode.cpp b/doomsday/engine/src/busymode.cpp index 82e076d89d..8bac36d564 100644 --- a/doomsday/engine/src/busymode.cpp +++ b/doomsday/engine/src/busymode.cpp @@ -146,7 +146,7 @@ static void beginTask(BusyTask* task) Window_SetDrawFunc(Window_Main(), BusyVisual_Render); - busyTask->_startTime = Sys_GetRealSeconds(); + busyTask->_startTime = Timer_RealSeconds(); } /** @@ -440,7 +440,7 @@ static void BusyMode_Loop(void) // We accumulate time in the busy loop so that the animation of a task // sequence doesn't jump around but remains continuous. oldTime = busyTime; - busyTime = Sys_GetRealSeconds() - busyTask->_startTime; + busyTime = Timer_RealSeconds() - busyTask->_startTime; if(busyTime > oldTime) { accumulatedBusyTime += busyTime - oldTime; diff --git a/doomsday/engine/src/client/cl_main.c b/doomsday/engine/src/client/cl_main.c index 6b54d6d993..2e3cd9e4cb 100644 --- a/doomsday/engine/src/client/cl_main.c +++ b/doomsday/engine/src/client/cl_main.c @@ -93,7 +93,7 @@ void Cl_InitID(void) } // Ah-ha, we need to generate a new ID. clientID = (ident_t) - ULONG(Sys_GetRealTime() * rand() + (rand() & 0xfff) + + ULONG(Timer_RealMilliseconds() * rand() + (rand() & 0xfff) + ((rand() & 0xfff) << 12) + ((rand() & 0xff) << 24)); // Write it to the file. if((file = fopen("client.id", "wb")) != NULL) diff --git a/doomsday/engine/src/client/cl_mobj.c b/doomsday/engine/src/client/cl_mobj.c index a3ed95c6e8..19f05099fb 100644 --- a/doomsday/engine/src/client/cl_mobj.c +++ b/doomsday/engine/src/client/cl_mobj.c @@ -397,7 +397,7 @@ void GameMap_ClMobjReset(GameMap* map) void GameMap_ExpireClMobjs(GameMap* map) { - uint nowTime = Sys_GetRealTime(); + uint nowTime = Timer_RealMilliseconds(); clmoinfo_t* info; clmoinfo_t* next = 0; mobj_t* mo; @@ -451,7 +451,7 @@ void Cl_PredictMovement(void) clmobj_t *cmo, *next = NULL; int i; int moCount = 0; - uint nowTime = Sys_GetRealTime(); + uint nowTime = Timer_RealMilliseconds(); predicted_tics++; @@ -550,7 +550,7 @@ mobj_t* ClMobj_Create(thid_t id) mo = (mobj_t*) ((char*)data + sizeof(clmoinfo_t)); // Initialize the data. - info->time = Sys_GetRealTime(); + info->time = Timer_RealMilliseconds(); info->startMagic = CLM_MAGIC1; info->endMagic = CLM_MAGIC2; mo->ddFlags = DDMF_REMOTE; @@ -793,7 +793,7 @@ void ClMobj_ReadDelta2(boolean skip) info->flags &= ~CLMF_UNPREDICTABLE; // This clmobj is evidently alive. - info->time = Sys_GetRealTime(); + info->time = Timer_RealMilliseconds(); } d = mo; @@ -1064,7 +1064,7 @@ void ClMobj_ReadNullDelta2(boolean skip) // This'll allow playing sounds from the mobj for a little while. // The mobj will soon time out and be permanently removed. - info->time = Sys_GetRealTime(); + info->time = Timer_RealMilliseconds(); info->flags |= CLMF_UNPREDICTABLE | CLMF_NULLED; #ifdef _DEBUG diff --git a/doomsday/engine/src/con_bar.c b/doomsday/engine/src/con_bar.c index ec948ca45f..beb2aeb9d1 100644 --- a/doomsday/engine/src/con_bar.c +++ b/doomsday/engine/src/con_bar.c @@ -79,7 +79,7 @@ void Con_ShutdownProgress(void) static int currentProgress(void) { - timespan_t nowTime = Sys_GetRealSeconds(); + timespan_t nowTime = Timer_RealSeconds(); timespan_t span = target.time - last.time; if(nowTime >= target.time || span <= 0) @@ -99,7 +99,7 @@ boolean Con_IsProgressAnimationCompleted(void) boolean done; lockProgress(true); - done = (Sys_GetRealSeconds() >= target.time); + done = (Timer_RealSeconds() >= target.time); lockProgress(false); return done; @@ -112,7 +112,7 @@ void Con_SetProgress(int progress) lockProgress(true); // Continue animation from the current value. - nowTime = Sys_GetRealSeconds(); + nowTime = Timer_RealSeconds(); last.value = currentProgress(); last.time = nowTime; diff --git a/doomsday/engine/src/dd_help.c b/doomsday/engine/src/dd_help.c index b21db81cc5..3ca31bba0a 100644 --- a/doomsday/engine/src/dd_help.c +++ b/doomsday/engine/src/dd_help.c @@ -294,7 +294,7 @@ void DD_InitHelp(void) if(helpInited) return; // Already inited. VERBOSE( Con_Message("Initializing Help subsystem...\n") ) - starttime = (verbose >= 2? Sys_GetSeconds() : 0); + starttime = (verbose >= 2? Timer_Seconds() : 0); // Init the links. helpRoot.next = helpRoot.prev = &helpRoot; @@ -312,7 +312,7 @@ void DD_InitHelp(void) // Help is now available. helpInited = true; - VERBOSE2( Con_Message("DD_InitHelp: Done in %.2f seconds.\n", Sys_GetSeconds() - starttime) ); + VERBOSE2( Con_Message("DD_InitHelp: Done in %.2f seconds.\n", Timer_Seconds() - starttime) ); } /** diff --git a/doomsday/engine/src/dd_loop.c b/doomsday/engine/src/dd_loop.c index 1bcbe56c5f..f1c3b5f9ae 100644 --- a/doomsday/engine/src/dd_loop.c +++ b/doomsday/engine/src/dd_loop.c @@ -256,7 +256,7 @@ void DD_GameLoopDrawer(void) static void startFrame(void) { - //frameStartAt = Sys_GetRealTime(); + //frameStartAt = Timer_RealMilliseconds(); S_StartFrame(); if(gx.BeginFrame) @@ -271,7 +271,7 @@ static void endFrame(void) { static uint lastFpsTime = 0; - uint nowTime = Sys_GetRealTime(); + uint nowTime = Timer_RealMilliseconds(); /* Con_Message("endFrame with %i ms (%i render)\n", nowTime - lastShowAt, nowTime - frameStartAt); @@ -515,7 +515,7 @@ void DD_WaitForOptimalUpdateTime(void) targetUpdateTime = prevUpdateTime + optimalDelta; // Check the current time. - nowTime = Sys_GetRealTime(); + nowTime = Timer_RealMilliseconds(); elapsed = nowTime - prevUpdateTime; if(elapsed < optimalDelta) @@ -532,7 +532,7 @@ void DD_WaitForOptimalUpdateTime(void) // Attempt to make sure we really wait until the optimal time. Sys_BlockUntilRealTime(targetUpdateTime); - nowTime = Sys_GetRealTime(); + nowTime = Timer_RealMilliseconds(); elapsed = nowTime - prevUpdateTime; } @@ -544,7 +544,7 @@ void DD_WaitForOptimalUpdateTime(void) timespan_t DD_LatestRunTicsStartTime(void) { - if(BusyMode_Active()) return Sys_GetSeconds(); + if(BusyMode_Active()) return Timer_Seconds(); return lastRunTicsTime; } @@ -566,12 +566,12 @@ static void runTics(void) { // On the first tic, no time actually passes. firstTic = false; - lastRunTicsTime = Sys_GetSeconds(); + lastRunTicsTime = Timer_Seconds(); return; } // Let's see how much time has passed. This is affected by "settics". - nowTime = Sys_GetSeconds(); + nowTime = Timer_Seconds(); elapsedTime = nowTime - lastRunTicsTime; // Remember when this frame started. diff --git a/doomsday/engine/src/dd_main.cpp b/doomsday/engine/src/dd_main.cpp index 86b05dbf6d..a71b7fec96 100644 --- a/doomsday/engine/src/dd_main.cpp +++ b/doomsday/engine/src/dd_main.cpp @@ -1473,7 +1473,7 @@ boolean DD_Init(void) { uint startTime; Con_Message("Parsing additional (pre-init) config files:\n"); - startTime = Sys_GetRealTime(); + startTime = Timer_RealMilliseconds(); for(;;) { const char* arg = CommandLine_Next(); @@ -1482,7 +1482,7 @@ boolean DD_Init(void) Con_Message(" Processing \"%s\"...\n", F_PrettyPath(arg)); Con_ParseCommands(arg); } - VERBOSE( Con_Message(" Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE( Con_Message(" Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } // A console command on the command line? @@ -1615,7 +1615,7 @@ static int DD_StartupWorker(void* parm) { uint startTime; Con_Message("Parsing additional (pre-init) config files:\n"); - startTime = Sys_GetRealTime(); + startTime = Timer_RealMilliseconds(); for(;;) { const char* arg = CommandLine_NextAsPath(); @@ -1624,7 +1624,7 @@ static int DD_StartupWorker(void* parm) Con_Message(" Processing \"%s\"...\n", F_PrettyPath(arg)); Con_ParseCommands(arg); } - VERBOSE( Con_Message(" Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE( Con_Message(" Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } // Add required engine resource files. diff --git a/doomsday/engine/src/def_main.cpp b/doomsday/engine/src/def_main.cpp index 53e1102003..0833f596bc 100644 --- a/doomsday/engine/src/def_main.cpp +++ b/doomsday/engine/src/def_main.cpp @@ -822,7 +822,7 @@ static __inline void readDefinitionFile(const char* fileName) static void readAllDefinitions(void) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); ddstring_t foundPath, buf; int p; @@ -911,7 +911,7 @@ static void readAllDefinitions(void) // Read DD_DEFNS definition lumps. Def_ReadLumpDefs(); - VERBOSE2( Con_Message(" Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE2( Con_Message(" Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } void Def_GenerateGroupsFromAnims(void) diff --git a/doomsday/engine/src/edit_bias.c b/doomsday/engine/src/edit_bias.c index dd0f3ea962..9d16dd0ca6 100644 --- a/doomsday/engine/src/edit_bias.c +++ b/doomsday/engine/src/edit_bias.c @@ -1063,7 +1063,7 @@ void SBE_DrawCursor(void) { #define SET_COL(x, r, g, b, a) {x[0]=(r); x[1]=(g); x[2]=(b); x[3]=(a);} - double t = Sys_GetRealTime()/100.0f; + double t = Timer_RealMilliseconds()/100.0f; source_t* s; coord_t hand[3]; float size = 10000; diff --git a/doomsday/engine/src/edit_map.cpp b/doomsday/engine/src/edit_map.cpp index b64b583d14..102e519af1 100644 --- a/doomsday/engine/src/edit_map.cpp +++ b/doomsday/engine/src/edit_map.cpp @@ -1378,7 +1378,7 @@ static boolean buildBsp(GameMap* gamemap) "Building BSP using tunable split factor of %d...\n", bspFactor); // It begins... - startTime = Sys_GetRealTime(); + startTime = Timer_RealMilliseconds(); bspBuilder = BspBuilder_New(gamemap, &map->numVertexes, &map->vertexes); BspBuilder_SetSplitCostFactor(bspBuilder, bspFactor); @@ -1393,7 +1393,7 @@ static boolean buildBsp(GameMap* gamemap) // How much time did we spend? LegacyCore_PrintfLogFragmentAtLevel(DE2_LOG_INFO, - "BSP built in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f); + "BSP built in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f); return builtOK; } diff --git a/doomsday/engine/src/gl_defer.c b/doomsday/engine/src/gl_defer.c index 617562bef1..ba8fcb7384 100644 --- a/doomsday/engine/src/gl_defer.c +++ b/doomsday/engine/src/gl_defer.c @@ -416,14 +416,14 @@ void GL_ProcessDeferredTasks(uint timeOutMilliSeconds) LIBDENG_ASSERT_IN_MAIN_THREAD(); LIBDENG_ASSERT_GL_CONTEXT_ACTIVE(); - startTime = Sys_GetRealTime(); + startTime = Timer_RealMilliseconds(); // We'll reserve names multiple times, because the worker thread may be // needing new texture names while we are uploading. GL_ReserveNames(); while((!timeOutMilliSeconds || - Sys_GetRealTime() - startTime < timeOutMilliSeconds) && + Timer_RealMilliseconds() - startTime < timeOutMilliSeconds) && (d = GL_NextDeferredTask()) != NULL) { processTask(d); diff --git a/doomsday/engine/src/map/dam_main.cpp b/doomsday/engine/src/map/dam_main.cpp index 16978c9bee..f655af6d65 100644 --- a/doomsday/engine/src/map/dam_main.cpp +++ b/doomsday/engine/src/map/dam_main.cpp @@ -358,9 +358,9 @@ boolean DAM_AttemptMapLoad(Uri const* _uri) R_InitFakeRadioForMap(); - { uint startTime = Sys_GetRealTime(); + { uint startTime = Timer_RealMilliseconds(); GameMap_InitSkyFix(map); - VERBOSE2( Con_Message("Initial sky fix done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE2( Con_Message("Initial sky fix done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } } } diff --git a/doomsday/engine/src/map/gamemap.c b/doomsday/engine/src/map/gamemap.c index ea21833462..f05acbfe51 100644 --- a/doomsday/engine/src/map/gamemap.c +++ b/doomsday/engine/src/map/gamemap.c @@ -459,7 +459,7 @@ void GameMap_InitNodePiles(GameMap* map) assert(map); VERBOSE( Con_Message("GameMap::InitNodePiles: Initializing...\n") ) - VERBOSE2( starttime = Sys_GetRealTime() ) + VERBOSE2( starttime = Timer_RealMilliseconds() ) // Initialize node piles and line rings. NP_Init(&map->mobjNodes, 256); // Allocate a small pile. @@ -474,7 +474,7 @@ void GameMap_InitNodePiles(GameMap* map) } // How much time did we spend? - VERBOSE2( Con_Message(" Done in %.2f seconds.\n", (Sys_GetRealTime() - starttime) / 1000.0f) ) + VERBOSE2( Con_Message(" Done in %.2f seconds.\n", (Timer_RealMilliseconds() - starttime) / 1000.0f) ) } void GameMap_InitLineDefBlockmap(GameMap* map, const_pvec2d_t min_, const_pvec2d_t max_) diff --git a/doomsday/engine/src/map/p_mobj.c b/doomsday/engine/src/map/p_mobj.c index 86f7399169..4c10a347ec 100644 --- a/doomsday/engine/src/map/p_mobj.c +++ b/doomsday/engine/src/map/p_mobj.c @@ -321,7 +321,7 @@ D_CMD(InspectMobj) Con_Printf("Tics:%i ddFlags:%08x\n", mo->tics, mo->ddFlags); if(info) { - Con_Printf("Cltime:%i (now:%i) Flags:%04x\n", info->time, Sys_GetRealTime(), info->flags); + Con_Printf("Cltime:%i (now:%i) Flags:%04x\n", info->time, Timer_RealMilliseconds(), info->flags); } Con_Printf("Flags:%08x Flags2:%08x Flags3:%08x\n", mo->flags, mo->flags2, mo->flags3); Con_Printf("Height:%f Radius:%f\n", mo->height, mo->radius); diff --git a/doomsday/engine/src/map/p_particle.c b/doomsday/engine/src/map/p_particle.c index 0bac6c6d5b..f8f1ff7fdc 100644 --- a/doomsday/engine/src/map/p_particle.c +++ b/doomsday/engine/src/map/p_particle.c @@ -154,14 +154,14 @@ static ptcgen_t* P_NewGenerator(void) void P_PtcInitForMap(void) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); // Spawn all type-triggered particle generators. // Let's hope there aren't too many... P_SpawnTypeParticleGens(); P_SpawnMapParticleGens(); - VERBOSE2( Con_Message("P_PtcInitForMap: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ) + VERBOSE2( Con_Message("P_PtcInitForMap: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ) } void P_MapSpawnPlaneParticleGens(void) diff --git a/doomsday/engine/src/network/net_buf.c b/doomsday/engine/src/network/net_buf.c index f79cab823e..f1f75ae769 100644 --- a/doomsday/engine/src/network/net_buf.c +++ b/doomsday/engine/src/network/net_buf.c @@ -130,7 +130,7 @@ void N_PostMessage(netmessage_t *msg) msg->next = NULL; // Set the timestamp for reception. - msg->receivedAt = Sys_GetRealSeconds(); + msg->receivedAt = Timer_RealSeconds(); if(msgTail) { @@ -173,7 +173,7 @@ netmessage_t *N_GetMessage(void) // Check for simulated latency. if(netSimulatedLatencySeconds > 0 && - (Sys_GetRealSeconds() - msg->receivedAt < netSimulatedLatencySeconds)) + (Timer_RealSeconds() - msg->receivedAt < netSimulatedLatencySeconds)) { // This message has not been received yet. msg = NULL; diff --git a/doomsday/engine/src/network/net_main.c b/doomsday/engine/src/network/net_main.c index 55f967c82a..b858fdcbf7 100644 --- a/doomsday/engine/src/network/net_main.c +++ b/doomsday/engine/src/network/net_main.c @@ -390,7 +390,7 @@ static void Net_DoUpdate(void) */ // Check time. - nowTime = Sys_GetTime(); + nowTime = Timer_Ticks(); // Clock reset? if(firstNetUpdate) @@ -860,7 +860,7 @@ void Net_Ticker(timespan_t time) if(cl->ping.sent) { // The pinger is active. - if(Sys_GetRealTime() - cl->ping.sent > PING_TIMEOUT) // Timed out? + if(Timer_RealMilliseconds() - cl->ping.sent > PING_TIMEOUT) // Timed out? { cl->ping.times[cl->ping.current] = -1; Net_SendPing(i, 0); @@ -1074,7 +1074,7 @@ D_CMD(SetTicks) // extern double lastSharpFrameTime; firstNetUpdate = true; - Sys_TicksPerSecond(strtod(argv[1], 0)); + Timer_SetTicksPerSecond(strtod(argv[1], 0)); // lastSharpFrameTime = Sys_GetTimef(); return true; } diff --git a/doomsday/engine/src/network/net_ping.c b/doomsday/engine/src/network/net_ping.c index bee7e7a6c0..6ccfefb003 100644 --- a/doomsday/engine/src/network/net_ping.c +++ b/doomsday/engine/src/network/net_ping.c @@ -112,7 +112,7 @@ void Net_SendPing(int player, int count) // Send a new ping. Msg_Begin(PKT_PING); - cl->ping.sent = Sys_GetRealTime(); + cl->ping.sent = Timer_RealMilliseconds(); Writer_WriteUInt32(msgWriter, cl->ping.sent); Msg_End(); @@ -132,7 +132,7 @@ void Net_PingResponse(void) { // Record the time and send the next ping. cl->ping.times[cl->ping.current] = - (Sys_GetRealTime() - time) / 1000.0f; + (Timer_RealMilliseconds() - time) / 1000.0f; // Show a notification. /*Con_Printf( "Ping to plr %i: %.0f ms.\n", netbuffer.player, cl->ping.times[cl->ping.current] * 1000); */ diff --git a/doomsday/engine/src/network/sys_network.c b/doomsday/engine/src/network/sys_network.c index 58bfe9d00c..8839497919 100644 --- a/doomsday/engine/src/network/sys_network.c +++ b/doomsday/engine/src/network/sys_network.c @@ -940,7 +940,7 @@ void N_PrintNetworkStatus(void) cl->handshake? '*' : ' ', cl->ready? '*' : ' ', plr->shared.inGame? '*' : ' ', - Sys_GetRealSeconds() - cl->enterTime); + Timer_RealSeconds() - cl->enterTime); } } if(first) diff --git a/doomsday/engine/src/r_things.c b/doomsday/engine/src/r_things.c index 25d11e7c4b..99e9694565 100644 --- a/doomsday/engine/src/r_things.c +++ b/doomsday/engine/src/r_things.c @@ -421,7 +421,7 @@ static int buildSpriteRotationsWorker(textureid_t texId, void* parameters) */ static void buildSpriteRotations(void) { - uint startTime = (verbose >= 2? Sys_GetRealTime() : 0); + uint startTime = (verbose >= 2? Timer_RealMilliseconds() : 0); numSpriteRecords = 0; spriteRecords = 0; @@ -430,7 +430,7 @@ static void buildSpriteRotations(void) Textures_IterateDeclared(TN_SPRITES, buildSpriteRotationsWorker); - VERBOSE2( Con_Message("buildSpriteRotations: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ) + VERBOSE2( Con_Message("buildSpriteRotations: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ) } /** @@ -534,7 +534,7 @@ static void initSpriteDefs(spriterecord_t* const * sprRecords, int num) void R_InitSprites(void) { - uint startTime = (verbose >= 2? Sys_GetRealTime() : 0); + uint startTime = (verbose >= 2? Timer_RealMilliseconds() : 0); VERBOSE( Con_Message("Initializing Sprites...\n") ) @@ -584,7 +584,7 @@ void R_InitSprites(void) spriteRecordFrameBlockSet = NULL; numSpriteRecords = 0; - VERBOSE2( Con_Message("R_InitSprites: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE2( Con_Message("R_InitSprites: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } void R_ShutdownSprites(void) diff --git a/doomsday/engine/src/r_world.c b/doomsday/engine/src/r_world.c index fe2a6f35f6..762e96e123 100644 --- a/doomsday/engine/src/r_world.c +++ b/doomsday/engine/src/r_world.c @@ -1502,10 +1502,10 @@ void R_SetupMap(int mode, int flags) R_MapInitSurfaces(true); R_MapInitSurfaceLists(); - startTime = Sys_GetSeconds(); + startTime = Timer_Seconds(); R_PrecacheForMap(); Materials_ProcessCacheQueue(); - VERBOSE( Con_Message("Precaching took %.2f seconds.\n", Sys_GetSeconds() - startTime) ) + VERBOSE( Con_Message("Precaching took %.2f seconds.\n", Timer_Seconds() - startTime) ) S_SetupForChangedMap(); diff --git a/doomsday/engine/src/render/r_fakeradio.c b/doomsday/engine/src/render/r_fakeradio.c index 13e0c536aa..d99cec569f 100644 --- a/doomsday/engine/src/render/r_fakeradio.c +++ b/doomsday/engine/src/render/r_fakeradio.c @@ -239,7 +239,7 @@ boolean R_IsShadowingLinedef(LineDef* line) void R_InitFakeRadioForMap(void) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); shadowlinkerparms_t data; Vertex* vtx0, *vtx1; @@ -301,5 +301,5 @@ void R_InitFakeRadioForMap(void) } } - VERBOSE2( Con_Message("R_InitFakeRadioForMap: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ) + VERBOSE2( Con_Message("R_InitFakeRadioForMap: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ) } diff --git a/doomsday/engine/src/render/r_lgrid.c b/doomsday/engine/src/render/r_lgrid.c index 2f2cb8d387..820dc35cab 100644 --- a/doomsday/engine/src/render/r_lgrid.c +++ b/doomsday/engine/src/render/r_lgrid.c @@ -150,7 +150,7 @@ static void AddIndexBit(int x, int y, uint *bitfield, int *count) */ void LG_InitForMap(void) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); #define MSFACTORS 7 typedef struct lgsamplepoint_s { @@ -550,7 +550,7 @@ Con_Message(" Sector %i: %i / %i\n", s, changedCount, count); // How much time did we spend? VERBOSE(Con_Message ("LG_InitForMap: Done in %.2f seconds.\n", - (Sys_GetRealTime() - startTime) / 1000.0f)); + (Timer_RealMilliseconds() - startTime) / 1000.0f)); } /** diff --git a/doomsday/engine/src/render/rend_bias.c b/doomsday/engine/src/render/rend_bias.c index 886dfb75e0..662b4a951f 100644 --- a/doomsday/engine/src/render/rend_bias.c +++ b/doomsday/engine/src/render/rend_bias.c @@ -321,7 +321,7 @@ void SB_Clear(void) */ void SB_InitForMap(const char* uniqueID) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); ded_light_t* def; int i; @@ -461,7 +461,7 @@ void SB_InitForMap(const char* uniqueID) } } - VERBOSE2( Con_Message("SB_InitForMap: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ) + VERBOSE2( Con_Message("SB_InitForMap: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ) } void SB_SetColor(float* dest, float* src) @@ -761,7 +761,7 @@ void SB_BeginFrame(void) BEGIN_PROF( PROF_BIAS_UPDATE ); // The time that applies on this frame. - currentTimeSB = Sys_GetRealTime(); + currentTimeSB = Timer_RealMilliseconds(); // Check which sources have changed. memset(&allChanges, 0, sizeof(allChanges)); diff --git a/doomsday/engine/src/resource/models.cpp b/doomsday/engine/src/resource/models.cpp index f00af0328a..ed5a60ba80 100644 --- a/doomsday/engine/src/resource/models.cpp +++ b/doomsday/engine/src/resource/models.cpp @@ -1215,7 +1215,7 @@ void R_InitModels(void) modelRepository = new de::StringPool(); LOG_VERBOSE("Initializing Models..."); - usedTime = Sys_GetRealTime(); + usedTime = Timer_RealMilliseconds(); clearModelList(); if(modefs) @@ -1295,7 +1295,7 @@ if(closest) #endif*/ } - VERBOSE2( Con_Message("R_InitModels: Done in %.2f seconds.\n", (Sys_GetRealTime() - usedTime) / 1000.0f) ); + VERBOSE2( Con_Message("R_InitModels: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - usedTime) / 1000.0f) ); } /** diff --git a/doomsday/engine/src/resource/r_data.c b/doomsday/engine/src/resource/r_data.c index 0db9046934..b9ae0b8afe 100644 --- a/doomsday/engine/src/resource/r_data.c +++ b/doomsday/engine/src/resource/r_data.c @@ -2101,7 +2101,7 @@ static void createTexturesForPatchCompositeDefs(patchcompositetex_t** defs, int void R_InitPatchComposites(void) { - uint startTime = (verbose >= 2? Sys_GetRealTime() : 0); + uint startTime = (verbose >= 2? Timer_RealMilliseconds() : 0); patchcompositetex_t** defs; int defsCount; @@ -2115,7 +2115,7 @@ void R_InitPatchComposites(void) free(defs); } - VERBOSE2( Con_Message("R_InitPatchComposites: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE2( Con_Message("R_InitPatchComposites: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } /// @todo Do this in the lump directory where we can make use of the hash! @@ -2162,7 +2162,7 @@ static Uri* composeFlatResourceUrn(lumpnum_t lumpNum) void R_InitFlatTextures(void) { - uint startTime = (verbose >= 2? Sys_GetRealTime() : 0); + uint startTime = (verbose >= 2? Timer_RealMilliseconds() : 0); lumpnum_t firstFlatMarkerLumpNum; VERBOSE( Con_Message("Initializing Flat textures...\n") ) @@ -2229,7 +2229,7 @@ void R_InitFlatTextures(void) } } - VERBOSE2( Con_Message("R_InitFlatTextures: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE2( Con_Message("R_InitFlatTextures: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } static boolean validSpriteName(const ddstring_t* name) @@ -2301,7 +2301,7 @@ static void defineAllSpriteTextures(void) void R_InitSpriteTextures(void) { - uint startTime = (verbose >= 2? Sys_GetRealTime() : 0); + uint startTime = (verbose >= 2? Timer_RealMilliseconds() : 0); int i, numLumps, uniqueId = 1/*1-based index*/; ddstring_t spriteName, decodedSpriteName; Uri* uri, *resourcePath; @@ -2372,7 +2372,7 @@ void R_InitSpriteTextures(void) // Define any as yet undefined sprite textures. defineAllSpriteTextures(); - VERBOSE2( Con_Message("R_InitSpriteTextures: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ) + VERBOSE2( Con_Message("R_InitSpriteTextures: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ) } Texture* R_CreateSkinTex(const Uri* filePath, boolean isShinySkin) diff --git a/doomsday/engine/src/resourcenamespace.cpp b/doomsday/engine/src/resourcenamespace.cpp index 4b31f81c10..be23de6097 100644 --- a/doomsday/engine/src/resourcenamespace.cpp +++ b/doomsday/engine/src/resourcenamespace.cpp @@ -349,7 +349,7 @@ void ResourceNamespace::rebuild() LOG_AS("ResourceNamespace::rebuild"); LOG_DEBUG("Rebuilding '%s'...") << d->name; - // uint startTime = Sys_GetRealTime(); + // uint startTime = Timer_RealMilliseconds(); // (Re)populate the directory and add found resources. clear(); @@ -360,7 +360,7 @@ void ResourceNamespace::rebuild() d->nameHashIsDirty = false; - // LOG_INFO("Done in %.2f seconds.") << (Sys_GetRealTime() - startTime) / 1000.0f; + // LOG_INFO("Done in %.2f seconds.") << (Timer_RealMilliseconds() - startTime) / 1000.0f; /*#if _DEBUG PathTree::debugPrint(d->directory); diff --git a/doomsday/engine/src/server/sv_main.c b/doomsday/engine/src/server/sv_main.c index 21981d4554..3fe554e622 100644 --- a/doomsday/engine/src/server/sv_main.c +++ b/doomsday/engine/src/server/sv_main.c @@ -421,7 +421,7 @@ void Sv_HandlePacket(void) Sv_Handshake(from, true); // Note the time when the player entered. - sender->enterTime = Sys_GetRealSeconds(); + sender->enterTime = Timer_RealSeconds(); } else if(ddpl->inGame) { @@ -619,7 +619,7 @@ void Sv_GetPackets(void) if(netconsole >= 0 && netconsole < DDMAXPLAYERS) { sender = &clients[netconsole]; - sender->shakePing = Sys_GetRealTime() - sender->shakePing; + sender->shakePing = Timer_RealMilliseconds() - sender->shakePing; Con_Printf("Cl%i handshake ping: %i ms\n", netconsole, sender->shakePing); @@ -756,7 +756,7 @@ void Sv_PlayerLeaves(unsigned int nodeID) // Print a little something in the console. Con_Message("Sv_PlayerLeaves: '%s' (console %i) has left, was connected for %f seconds.\n", - cl->name, plrNum, Sys_GetRealSeconds() - cl->enterTime); + cl->name, plrNum, Timer_RealSeconds() - cl->enterTime); wasInGame = plr->shared.inGame; plr->shared.inGame = false; @@ -839,7 +839,7 @@ void Sv_Handshake(int plrNum, boolean newPlayer) if(newPlayer) { // Note the time when the handshake was sent. - clients[plrNum].shakePing = Sys_GetRealTime(); + clients[plrNum].shakePing = Timer_RealMilliseconds(); } // The game DLL wants to shake hands as well? diff --git a/doomsday/engine/src/server/sv_pool.c b/doomsday/engine/src/server/sv_pool.c index c699bd01f5..c11d4834c1 100644 --- a/doomsday/engine/src/server/sv_pool.c +++ b/doomsday/engine/src/server/sv_pool.c @@ -42,7 +42,6 @@ #include "m_misc.h" #include "audio/s_main.h" -#include "timer.h" // MACROS ------------------------------------------------------------------ @@ -138,7 +137,7 @@ void Sv_InitPools(void) // Clients don't register anything. if(isClient) return; - startTime = Sys_GetRealTime(); + startTime = Timer_RealMilliseconds(); // Set base priority scores for all the delta types. for(i = 0; i < NUM_DELTA_TYPES; ++i) @@ -181,7 +180,7 @@ void Sv_InitPools(void) // How much time did we spend? DEBUG_Message(("Sv_InitPools: World registered, done in %.2f seconds.\n", - (Sys_GetRealTime() - startTime) / 1000.0f)); + (Timer_RealMilliseconds() - startTime) / 1000.0f)); } /** @@ -1018,7 +1017,7 @@ void Sv_UpdateOwnerInfo(pool_t* pool) */ uint Sv_GetTimeStamp(void) { - return Sys_GetRealTime(); + return Timer_RealMilliseconds(); } /** diff --git a/doomsday/engine/src/sys_system.c b/doomsday/engine/src/sys_system.c index 462872342e..cdc7cbc124 100644 --- a/doomsday/engine/src/sys_system.c +++ b/doomsday/engine/src/sys_system.c @@ -76,9 +76,7 @@ void Sys_Init(void) Con_Message("Setting up platform state...\n"); - VERBOSE( Con_Message("Initializing Timing subsystem...\n") ) - Sys_InitTimer(); - startTime = (verbose >= 2? Sys_GetRealTime() : 0); + startTime = (verbose >= 2? Timer_RealMilliseconds() : 0); if(!isDedicated) { @@ -112,7 +110,7 @@ void Sys_Init(void) VERBOSE( Con_Message("Initializing Network subsystem...\n") ) N_Init(); - VERBOSE2( Con_Message("Sys_Init: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) ); + VERBOSE2( Con_Message("Sys_Init: Done in %.2f seconds.\n", (Timer_RealMilliseconds() - startTime) / 1000.0f) ); } boolean Sys_IsShuttingDown(void) @@ -133,8 +131,6 @@ void Sys_Shutdown(void) Con_Execute(CMDS_DDAY, "unload", true, false); B_Shutdown(); - Sys_ShutdownTimer(); - Net_Shutdown(); // Let's shut down sound first, so Windows' HD-hogging doesn't jam // the MUS player (would produce horrible bursts of notes). @@ -232,7 +228,7 @@ void Sys_Sleep(int millisecs) void Sys_BlockUntilRealTime(uint realTimeMs) { - uint remaining = realTimeMs - Sys_GetRealTime(); + uint remaining = realTimeMs - Timer_RealMilliseconds(); if(remaining > 50) { // Target time is in the past; or the caller is attempting to wait for @@ -240,7 +236,7 @@ void Sys_BlockUntilRealTime(uint realTimeMs) return; } - while(Sys_GetRealTime() < realTimeMs) + while(Timer_RealMilliseconds() < realTimeMs) { // Do nothing; don't yield execution. We want to exit here at the // precise right moment. diff --git a/doomsday/engine/src/ui/b_device.c b/doomsday/engine/src/ui/b_device.c index 25daae8b84..833627554a 100644 --- a/doomsday/engine/src/ui/b_device.c +++ b/doomsday/engine/src/ui/b_device.c @@ -278,7 +278,7 @@ void B_EvaluateDeviceBindingList(int localNum, dbinding_t* listRoot, float* pos, float devicePos; float deviceOffset; uint deviceTime; - uint nowTime = Sys_GetRealTime(); + uint nowTime = Timer_RealMilliseconds(); boolean conflicted[NUM_CBD_TYPES] = { false, false, false }; boolean appliedState[NUM_CBD_TYPES] = { false, false, false }; diff --git a/doomsday/engine/src/ui/busyvisual.c b/doomsday/engine/src/ui/busyvisual.c index 66dde47b7a..7edc5e4c8e 100644 --- a/doomsday/engine/src/ui/busyvisual.c +++ b/doomsday/engine/src/ui/busyvisual.c @@ -62,13 +62,13 @@ static void acquireScreenshotTexture(void) } #ifdef _DEBUG - startTime = Sys_GetRealSeconds(); + startTime = Timer_RealSeconds(); #endif texScreenshot = Window_GrabAsTexture(Window_Main(), true /*halfsized*/); DEBUG_Message(("Busy Mode: Took %.2f seconds acquiring screenshot texture #%i.\n", - Sys_GetRealSeconds() - startTime, texScreenshot)); + Timer_RealSeconds() - startTime, texScreenshot)); } void BusyVisual_ReleaseTextures(void) @@ -347,7 +347,7 @@ static void drawConsoleOutput(void) if(!buffer) return; newCount = GetBufLines(buffer, visibleBusyLines); - nowTime = Sys_GetRealSeconds(); + nowTime = Timer_RealSeconds(); if(newCount > 0) { timeSinceLastNew = nowTime - lastNewTime; @@ -514,7 +514,7 @@ void Con_TransitionConfigure(void) void Con_TransitionBegin(void) { - transition.startTime = Sys_GetTime(); + transition.startTime = Timer_Ticks(); transition.position = 0; } @@ -540,7 +540,7 @@ void Con_TransitionTicker(timespan_t ticLength) if(isDedicated) return; if(!Con_TransitionInProgress()) return; - transition.position = (float)(Sys_GetTime() - transition.startTime) / transition.tics; + transition.position = (float)(Timer_Ticks() - transition.startTime) / transition.tics; if(transition.position >= 1) { Con_EndTransition(); diff --git a/doomsday/engine/src/ui/dd_input.c b/doomsday/engine/src/ui/dd_input.c index 06bafb0c13..bf31c30d72 100644 --- a/doomsday/engine/src/ui/dd_input.c +++ b/doomsday/engine/src/ui/dd_input.c @@ -730,7 +730,7 @@ void I_TrackInput(ddevent_t *ev) // Mark down the time when the change occurs. if(ev->toggle.state == ETOG_DOWN || ev->toggle.state == ETOG_UP) { - key->time = Sys_GetRealTime(); + key->time = Timer_RealMilliseconds(); } if(key->isDown) @@ -751,7 +751,7 @@ void I_TrackInput(ddevent_t *ev) hat->pos = ev->angle.pos; // Mark down the time when the change occurs. - hat->time = Sys_GetRealTime(); + hat->time = Timer_RealMilliseconds(); // We can clear the expiration when the hat is centered. if(hat->pos < 0) @@ -1379,7 +1379,7 @@ void DD_ReadMouse(void) if(mouseFreq > 0) { static uint lastTime = 0; - uint nowTime = Sys_GetRealTime(); + uint nowTime = Timer_RealMilliseconds(); if(nowTime - lastTime < 1000/mouseFreq) { diff --git a/doomsday/engine/src/ui/p_control.c b/doomsday/engine/src/ui/p_control.c index 6b67f7e6f5..ce7463185f 100644 --- a/doomsday/engine/src/ui/p_control.c +++ b/doomsday/engine/src/ui/p_control.c @@ -281,7 +281,7 @@ void P_MaintainControlDoubleClicks(int playerNum, int control, float pos) } // We have an activation! - nowTime = Sys_GetRealTime(); + nowTime = Timer_RealMilliseconds(); if(newState == db->previousClickState && nowTime - db->previousClickTime < (uint) MAX_OF(0, doubleClickThresholdMilliseconds)) diff --git a/doomsday/libdeng/include/de/timer.h b/doomsday/libdeng/include/de/timer.h new file mode 100644 index 0000000000..da0511f6b8 --- /dev/null +++ b/doomsday/libdeng/include/de/timer.h @@ -0,0 +1,90 @@ +/** + * @file timer.h + * Timing subsystem. @ingroup system + * + * @authors Copyright © 2003-2012 Jaakko Keränen + * + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef __DOOMSDAY_SYSTEM_TIMER_H__ +#define __DOOMSDAY_SYSTEM_TIMER_H__ + +#include "types.h" + +#define TICRATE 35 // Number of tics / second. +#define TICSPERSEC 35 +#define SECONDSPERTIC (1.0f/TICSPERSEC) + +#ifdef __cplusplus +extern "C" { +#endif + +void Timer_Init(void); + +void Timer_Shutdown(void); + +/** + * Current time measured in game ticks. + * + * @return Game ticks. + */ +DENG_PUBLIC int Timer_Ticks(void); + +/** + * Current time measured in game ticks. + * + * @return Floating-point game ticks. + */ +DENG_PUBLIC double Timer_Ticksf(void); + +/** + * Current time in seconds. Affected by the ticksPerSecond modifier. + * + * @return Seconds. + */ +DENG_PUBLIC double Timer_Seconds(void); + +/** + * Elapsed time since initialization. Not affected by the ticksPerSecond modifier. + * + * @return Milliseconds. + */ +DENG_PUBLIC uint Timer_RealMilliseconds(void); + +/** + * Elapsed time since initialization. Not affected by the ticksPerSecond modifier. + * + * @return Seconds. + */ +DENG_PUBLIC double Timer_RealSeconds(void); + +/** + * Set the number of game ticks per second. + * + * @param num Number of ticks per second (default: 35). + */ +DENG_PUBLIC void Timer_SetTicksPerSecond(float num); + +/** + * Returns the current number of ticks per second (default: 35). + */ +DENG_PUBLIC float Timer_TicksPerSecond(void); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/doomsday/libdeng/libdeng.pro b/doomsday/libdeng/libdeng.pro index 6d272c92a1..60fec12092 100644 --- a/doomsday/libdeng/libdeng.pro +++ b/doomsday/libdeng/libdeng.pro @@ -60,6 +60,7 @@ HEADERS += \ include/de/smoother.h \ include/de/str.h \ include/de/str.hh \ + include/de/timer.h \ include/de/types.h \ include/de/unittest.h \ include/de/writer.h @@ -75,6 +76,7 @@ SOURCES += \ src/reader.c \ src/smoother.cpp \ src/str.c \ + src/timer.cpp \ src/writer.c # Installation --------------------------------------------------------------- diff --git a/doomsday/libdeng/src/libdeng.c b/doomsday/libdeng/src/libdeng.c index bf5b26a992..6e42d6d7eb 100644 --- a/doomsday/libdeng/src/libdeng.c +++ b/doomsday/libdeng/src/libdeng.c @@ -22,10 +22,12 @@ #include "de/libdeng.h" #include "de/garbage.h" #include "de/concurrency.h" +#include "de/timer.h" #include "memoryzone_private.h" void Libdeng_Init(void) { + Timer_Init(); Z_Init(); Garbage_Init(); Sys_MarkAsMainThread(); @@ -35,4 +37,5 @@ void Libdeng_Shutdown(void) { Garbage_Shutdown(); Z_Shutdown(); + Timer_Shutdown(); } diff --git a/doomsday/engine/src/timer.cpp b/doomsday/libdeng/src/timer.cpp similarity index 70% rename from doomsday/engine/src/timer.cpp rename to doomsday/libdeng/src/timer.cpp index 80778dbca0..6d7b7b4f55 100644 --- a/doomsday/engine/src/timer.cpp +++ b/doomsday/libdeng/src/timer.cpp @@ -25,24 +25,16 @@ #include -#include "de_platform.h" - #ifdef WIN32 -# include -#endif - -/* -#ifdef UNIX -# include +# define WIN32_LEAN_AND_MEAN +# include +# include #endif -*/ -#include "de_base.h" -#include "de_console.h" -#include - -float ticsPerSecond = TICSPERSEC; +#include "de/timer.h" +#include "de/concurrency.h" +static float ticksPerSecond = TICSPERSEC; static double timeOffset = 0; static mutex_t timerMutex; // To prevent Data races in the timer static QTime startedAt; @@ -50,7 +42,7 @@ static uint timerOffset = 0; const static uint TIMER_WARP_INTERVAL = 12*60*60*1000; -void Sys_ShutdownTimer(void) +void Timer_Shutdown(void) { #ifdef WIN32 timeEndPeriod(1); @@ -60,7 +52,7 @@ void Sys_ShutdownTimer(void) Sys_DestroyMutex(m); } -void Sys_InitTimer(void) +void Timer_Init(void) { assert(timerMutex == 0); timerMutex = Sys_CreateMutex("TIMER_MUTEX"); @@ -71,13 +63,10 @@ void Sys_InitTimer(void) timerOffset = 0; } -/** - * @return The time in milliseconds. - */ -unsigned int Sys_GetRealTime(void) +unsigned int Timer_RealMilliseconds(void) { static boolean first = true; - static DWORD start; + static unsigned int start; #ifdef WIN32 DWORD return_time, now; #else @@ -128,52 +117,41 @@ unsigned int Sys_GetRealTime(void) return return_time; } -/** - * @return The timer value in seconds. Affected by the ticsPerSecond modifier. - */ -double Sys_GetSeconds(void) +double Timer_Seconds(void) { - return (double) ((Sys_GetRealTime() / 1000.0) * (ticsPerSecond / 35)) + - timeOffset; + return (double) ((Timer_RealMilliseconds() / 1000.0) * (ticksPerSecond / 35)) + timeOffset; } -/** - * @return The real timer value in seconds. - */ -double Sys_GetRealSeconds(void) +double Timer_RealSeconds(void) { - return (double) (Sys_GetRealTime() / 1000.0); + return (double) (Timer_RealMilliseconds() / 1000.0); } -/** - * @return The time in 35 Hz floating point tics. - */ -double Sys_GetTimef(void) +double Timer_Ticksf(void) { - return Sys_GetSeconds() * 35; + return Timer_Seconds() * 35; } -/** - * @return The time in 35 Hz tics. - */ -int Sys_GetTime(void) +int Timer_Ticks(void) { - return (int) Sys_GetTimef(); + return (int) Timer_Ticksf(); } -/** - * @return Set the number of game tics per second. - */ -void Sys_TicksPerSecond(float newTics) +void Timer_SetTicksPerSecond(float newTics) { - double nowTime = Sys_GetRealTime() / 1000.0; + double nowTime = Timer_RealMilliseconds() / 1000.0; if(newTics <= 0) newTics = TICSPERSEC; // Update the time offset so that after the change time will // continue from the same value. - timeOffset += nowTime * (ticsPerSecond - newTics) / 35; + timeOffset += nowTime * (ticksPerSecond - newTics) / 35; + + ticksPerSecond = newTics; +} - ticsPerSecond = newTics; +float Timer_TicksPerSecond(void) +{ + return ticksPerSecond; } diff --git a/doomsday/plugins/common/include/common.h b/doomsday/plugins/common/include/common.h index 087dc1421e..0c446a038e 100644 --- a/doomsday/plugins/common/include/common.h +++ b/doomsday/plugins/common/include/common.h @@ -22,6 +22,8 @@ #ifndef LIBCOMMON_GAME_INCLUDES #define LIBCOMMON_GAME_INCLUDES +#include + #define WEAPONBOTTOM (128) // from p_pspr.c #define IS_NETWORK_SERVER (DD_GetInteger(DD_SERVER) && DD_GetInteger(DD_NETGAME)) diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index f4230acd9c..05ae8ead42 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -1524,7 +1524,7 @@ void G_DoQuitGame(void) if(!quitInProgress) { quitInProgress = true; - quitTime = Sys_GetRealTime(); + quitTime = Timer_RealMilliseconds(); Hu_MenuCommand(MCMD_CLOSEFAST); @@ -1578,13 +1578,13 @@ void G_DoQuitGame(void) } } - if(Sys_GetRealTime() > quitTime + QUITWAIT_MILLISECONDS) + if(Timer_RealMilliseconds() > quitTime + QUITWAIT_MILLISECONDS) { Sys_Quit(); } else { - float t = (Sys_GetRealTime() - quitTime) / (float) QUITWAIT_MILLISECONDS; + float t = (Timer_RealMilliseconds() - quitTime) / (float) QUITWAIT_MILLISECONDS; quitDarkenOpacity = t*t*t; } diff --git a/doomsday/plugins/common/src/p_saveg.c b/doomsday/plugins/common/src/p_saveg.c index c81a44f2ee..bf2eba75ce 100644 --- a/doomsday/plugins/common/src/p_saveg.c +++ b/doomsday/plugins/common/src/p_saveg.c @@ -1136,7 +1136,7 @@ static playerheader_t* getPlayerHeader(void) uint SV_GenerateGameId(void) { - return Sys_GetRealTime() + (mapTime << 24); + return Timer_RealMilliseconds() + (mapTime << 24); } /** diff --git a/doomsday/plugins/directsound/src/driver_directsound.cpp b/doomsday/plugins/directsound/src/driver_directsound.cpp index db338083be..cbe193ff1a 100644 --- a/doomsday/plugins/directsound/src/driver_directsound.cpp +++ b/doomsday/plugins/directsound/src/driver_directsound.cpp @@ -685,7 +685,7 @@ void DS_SFX_Play(sfxbuffer_t* buf) if(!(buf->flags & SFXBF_PLAYING)) { // Calculate the end time (milliseconds). - buf->endTime = Sys_GetRealTime() + getBufLength(buf); + buf->endTime = Timer_RealMilliseconds() + getBufLength(buf); } if(FAILED(hr = DSBUF(buf)->Play(0, 0, DSBPLAY_LOOPING))) @@ -745,7 +745,7 @@ void DS_SFX_Refresh(sfxbuffer_t* buf) if(!buf || !buf->sample || !(buf->flags & SFXBF_PLAYING)) return; - nowTime = Sys_GetRealTime(); + nowTime = Timer_RealMilliseconds(); /** * Have we passed the predicted end of sample? diff --git a/doomsday/plugins/wadmapconverter/src/id1map.cpp b/doomsday/plugins/wadmapconverter/src/id1map.cpp index 64af98c914..5ff76905be 100644 --- a/doomsday/plugins/wadmapconverter/src/id1map.cpp +++ b/doomsday/plugins/wadmapconverter/src/id1map.cpp @@ -26,6 +26,7 @@ #include #include #include +#include static Reader* bufferLump(MapLumpInfo* info); static void clearReadBuffer(void); @@ -465,7 +466,7 @@ void Id1Map::transferThings(void) int Id1Map::transfer(void) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); LOG_AS("Id1Map"); @@ -476,7 +477,7 @@ int Id1Map::transfer(void) transferPolyobjs(); transferThings(); - LOG_VERBOSE("Transfer completed in %.2f seconds.") << ((Sys_GetRealTime() - startTime) / 1000.0f); + LOG_VERBOSE("Transfer completed in %.2f seconds.") << ((Timer_RealMilliseconds() - startTime) / 1000.0f); return false; // Success. } diff --git a/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp b/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp index c2e42e6ca7..5eeca9b26c 100644 --- a/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp +++ b/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp @@ -23,6 +23,7 @@ #include "wadmapconverter.h" #include +#include static uint validCount = 0; // Used for Polyobj LineDef collection. @@ -229,7 +230,7 @@ void Id1Map::findPolyobjs(void) void Id1Map::analyze(void) { - uint startTime = Sys_GetRealTime(); + uint startTime = Timer_RealMilliseconds(); LOG_AS("Id1Map"); if(mapFormat == MF_HEXEN) @@ -237,5 +238,5 @@ void Id1Map::analyze(void) findPolyobjs(); } - LOG_VERBOSE("Analyses completed in %.2f seconds.") << ((Sys_GetRealTime() - startTime) / 1000.0f); + LOG_VERBOSE("Analyses completed in %.2f seconds.") << ((Timer_RealMilliseconds() - startTime) / 1000.0f); } diff --git a/doomsday/plugins/wadmapconverter/src/id1map_loadblockmap.cpp b/doomsday/plugins/wadmapconverter/src/id1map_loadblockmap.cpp index 68914d77cf..7c3977b8fe 100644 --- a/doomsday/plugins/wadmapconverter/src/id1map_loadblockmap.cpp +++ b/doomsday/plugins/wadmapconverter/src/id1map_loadblockmap.cpp @@ -69,7 +69,7 @@ bool LoadBlockmap(MapLumpInfo* lumpInfo) LOG_INFO("Converting blockmap..."); - startTime = Sys_GetRealTime(); + startTime = Timer_RealMilliseconds(); blockmapLump = (short*) W_CacheLump(lumpInfo->lump, PU_GAMESTATIC); @@ -176,7 +176,7 @@ bool LoadBlockmap(MapLumpInfo* lumpInfo) map->blockMap = blockmap; // How much time did we spend? - LOG_INFO(" Done in %.2f seconds.") << ((Sys_GetRealTime() - startTime) / 1000.0f); + LOG_INFO(" Done in %.2f seconds.") << ((Timer_RealMilliseconds() - startTime) / 1000.0f); return true; diff --git a/doomsday/plugins/winmm/src/cdaudio.cpp b/doomsday/plugins/winmm/src/cdaudio.cpp index f4ec12e7fc..f337f7c7f7 100644 --- a/doomsday/plugins/winmm/src/cdaudio.cpp +++ b/doomsday/plugins/winmm/src/cdaudio.cpp @@ -218,7 +218,7 @@ void DM_CDAudio_Update(void) // Check for looping. if(cdCurrentTrack && cdLooping && - Sys_GetSeconds() - cdStartTime > cdTrackLength) + Timer_Seconds() - cdStartTime > cdTrackLength) { // Restart the track. DM_CDAudio_Play(cdCurrentTrack, true); @@ -247,7 +247,7 @@ int DM_CDAudio_Play(int track, int looped) // Success! cdLooping = (looped? true:false); - cdStartTime = Sys_GetSeconds(); + cdStartTime = Timer_Seconds(); return cdCurrentTrack = track; } @@ -261,9 +261,9 @@ void DM_CDAudio_Pause(int pause) sendMCICmd(0, 0, "%s " DEVICEID, pause ? "pause" : "play"); if(pause) - cdPauseTime = Sys_GetSeconds(); + cdPauseTime = Timer_Seconds(); else - cdStartTime += Sys_GetSeconds() - cdPauseTime; + cdStartTime += Timer_Seconds() - cdPauseTime; } /**