aboutsummaryrefslogtreecommitdiff
path: root/src/physics.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/physics.c')
-rw-r--r--src/physics.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/physics.c b/src/physics.c
index 3472cc5..91505b9 100644
--- a/src/physics.c
+++ b/src/physics.c
@@ -15,6 +15,8 @@
#include <SDL.h>
#include <math.h>
+#include <sys/time.h>
+#include <time.h>
#include "types.h"
#include "model.h"
@@ -403,9 +405,14 @@ static void physics_process(ModelInstance *obj, Uint32 dt, Game *game) {
void physics_step(Game *game, Uint32 t) {
Uint32 dt;
+ struct timeval tv;
+ suseconds_t us;
dt = t - game->tlast;
+ gettimeofday(&tv, NULL);
+ us = tv.tv_usec;
+
/* Handle things specific to the lander craft */
if ( game->thrusting ) {
if ( game->fuel > 0.0 ) {
@@ -454,6 +461,12 @@ void physics_step(Game *game, Uint32 t) {
game_check_handoff(game);
game->tlast = t;
+
+ gettimeofday(&tv, NULL);
+ us = tv.tv_usec - us;
+
+ game->time_physics = us;
+
}