Skip to content

Commit

Permalink
Client|Loop: Length of current tick can be queried
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 3, 2014
1 parent ecb1b96 commit a890ce7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions doomsday/client/include/dd_loop.h
Expand Up @@ -79,6 +79,11 @@ dd_bool DD_IsFrameTimeAdvancing(void);
*/
timespan_t DD_LatestRunTicsStartTime(void);

/**
* Returns how much time has elapsed during the current tick.
*/
timespan_t DD_CurrentTickDuration(void);

/**
* Sets the exit code for the main loop. Does not cause the main loop
* to stop; you need to call Sys_Quit() to do that.
Expand Down
9 changes: 8 additions & 1 deletion doomsday/client/src/dd_loop.cpp
Expand Up @@ -363,9 +363,16 @@ timespan_t DD_LatestRunTicsStartTime(void)
return lastRunTicsTime;
}

static double ticLength;

timespan_t DD_CurrentTickDuration()
{
return ticLength;
}

void Loop_RunTics(void)
{
double elapsedTime, ticLength, nowTime;
double elapsedTime, nowTime;

// Do a network update first.
N_Update();
Expand Down

0 comments on commit a890ce7

Please sign in to comment.