From 3ec96c9a81f0f770fac75a1bdfc16ea96df07d9b Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Fri, 9 Mar 2018 00:21:17 -0700 Subject: Swapped to OGGetAbsoluteTime for timestamp --- data_recorder.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'data_recorder.c') diff --git a/data_recorder.c b/data_recorder.c index 323d208..63746c3 100644 --- a/data_recorder.c +++ b/data_recorder.c @@ -15,6 +15,8 @@ #include #include +#include "redist/os_generic.h" + struct SurviveContext * ctx; FILE* output_file = 0; @@ -49,21 +51,18 @@ int bufferpts[32*2*3]; char buffermts[32*128*3]; int buffertimeto[32*3]; -uint64_t timestamp_in_us() { - static uint64_t start_time_us = 0; - struct timeval tv; - gettimeofday(&tv,NULL); - uint64_t now = (uint64_t)tv.tv_sec * 1000000L + tv.tv_usec; +double timestamp_in_us() { + static double start_time_us = 0; if(start_time_us == 0) - start_time_us = now; - return now - start_time_us; + start_time_us = OGGetAbsoluteTime(); + return OGGetAbsoluteTime() - start_time_us; } int write_to_output(const char *format, ...) { va_list args; va_start(args, format); - fprintf(output_file, "%lu ", timestamp_in_us()); + fprintf(output_file, "%.17g ", timestamp_in_us()); vfprintf(output_file, format, args); va_end(args); -- cgit v1.2.3