medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit d6528975af55e5765e11666558a16ef8d9e2eb9a
parent c2fc3b92b80ceed396f202be4f2cb17dacd335d8
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Mon Dec 26 11:17:37 +0200

Use glfwGetTime instead of gettimeofday for portability

Diffstat:
profiler.cc | 15++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/profiler.cc b/profiler.cc @@ -1,19 +1,12 @@ #include <stdio.h> -#include <unistd.h> -#include <sys/time.h> + +#include <GLFW/glfw3.h> #include "intrinsics.h" #include "profiler.h" #include "stats.h" #include "str.h" -static double get_time() { - struct timeval tv; - gettimeofday( &tv, NULL ); - - return ( double ) tv.tv_sec + tv.tv_usec / 1000000.0; -} - struct Timer { const char * name; const char * file; @@ -63,7 +56,7 @@ void profiler_push( u32 timer_idx ) { ASSERT( timer_stack_top < TIMER_STACK_SIZE ); timer_stack[ timer_stack_top ].timer_idx = timer_idx; - timer_stack[ timer_stack_top ].pushed_at = get_time(); + timer_stack[ timer_stack_top ].pushed_at = glfwGetTime(); timer_stack_top++; } @@ -88,7 +81,7 @@ static void print_frame( double frame_dt ) { void profiler_pop() { ASSERT( timer_stack_top > 0 ); - double now = get_time(); + double now = glfwGetTime(); timer_stack_top--; u32 idx = timer_stack[ timer_stack_top ].timer_idx;