# HG changeset patch # User Mychaela Falconia # Date 1584132457 0 # Node ID 00060bb8b2407ae82529d412a723e364692b975c # Parent e77d478e372499ce8d1bb6adfa750d86c6419a58 fluid-mnf/misc.c: fixed stopwatch functions for Unix diff -r e77d478e3724 -r 00060bb8b240 fluid-mnf/misc.c --- a/fluid-mnf/misc.c Fri Mar 13 19:59:27 2020 +0000 +++ b/fluid-mnf/misc.c Fri Mar 13 20:47:37 2020 +0000 @@ -16,11 +16,7 @@ #include #include -#include - -#if defined(MSC) || defined(BCC) -#include "windows.h" -#endif +#include /****************************************************************************** @@ -213,22 +209,22 @@ } } +static int get_milliseconds(void) +{ + struct timeval tv; + + gettimeofday(&tv, 0); + return ((int) tv.tv_sec * 1000) + ((int) tv.tv_usec / 1000); +} + int stopwatch_start(void) { -#if defined(MSC) || defined(BCC) - return GetTickCount(); -#else - return 1000 * time(NULL); -#endif + return get_milliseconds(); } int stopwatch_stop(int time_start) { -#if defined(MSC) || defined(BCC) - return GetTickCount() - time_start; -#else - return 1000 * (time(NULL) - time_start); -#endif + return get_milliseconds() - time_start; }