Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ce3a6aac0
|
@@ -29,7 +29,7 @@ program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o
|
||||
doble : main.o $(program_obj_files)
|
||||
$(CC) $(FLAGS) $^ -o doble
|
||||
|
||||
$(program_obj_filesobj_files): %.o: %.c
|
||||
$(program_obj_files): %.o: %.c
|
||||
$(CC) -c $(FLAGS) $^ -o $@
|
||||
|
||||
# --------------------------
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
#include "timer.h"
|
||||
|
||||
#ifdef __linux__
|
||||
// Defines strict posix compliance for CLOCK_MONOTONIC
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __linux__
|
||||
#if __APPLE__
|
||||
#include <sys/time.h>
|
||||
static struct timespec start = {0, 0};
|
||||
|
||||
@@ -27,8 +21,7 @@ double stopTimer()
|
||||
|
||||
double measuredSeconds = (double)delta_us / 1000000.;
|
||||
|
||||
if (start.tv_nsec > 0)
|
||||
{
|
||||
if(start.tv_nsec > 0) {
|
||||
start.tv_nsec = 0;
|
||||
start.tv_sec = 0;
|
||||
}
|
||||
@@ -52,7 +45,7 @@ double stopTimer()
|
||||
{
|
||||
double measuredSeconds = (clock() - (double)startClocks) / CLOCKS_PER_SEC;
|
||||
|
||||
if (startClocks > 0)
|
||||
if(startClocks > 0)
|
||||
startClocks = 0;
|
||||
else
|
||||
measuredSeconds = -1;
|
||||
|
||||
Reference in New Issue
Block a user