Fix timer

This commit is contained in:
Tobias Linz committed 2026-11-19 10:31:42 +01:00
1 parent 26c508e9e0
commit d33610fe67
1 file changed
+2 -25
+2 -25
View File
@@ -1,7 +1,7 @@
#include "timer.h" #include "timer.h"
#if __APPLE__ #include <time.h>
#include <sys/time.h>
static struct timespec start = {0, 0}; static struct timespec start = {0, 0};
// Starts the timer. // Starts the timer.
@@ -30,26 +30,3 @@ double stopTimer()
return measuredSeconds; return measuredSeconds;
} }
#else
#include <time.h>
static clock_t startClocks = 0;
// Starts the timer.
void startTimer()
{
startClocks = clock();
}
// Returns the time in seconds since startTimer() was called.
double stopTimer()
{
double measuredSeconds = (clock() - (double)startClocks) / CLOCKS_PER_SEC;
if(startClocks > 0)
startClocks = 0;
else
measuredSeconds = -1;
return measuredSeconds;
}
#endif