Compare commits
5 Commits
4880a9d2f4
...
e4db0beda0
| Author | SHA1 | Date | |
|---|---|---|---|
| e4db0beda0 | |||
| 746b9b7219 | |||
| 1f3fba80ec | |||
| 1d363980f6 | |||
| 4ce3a6aac0 |
Binary file not shown.
2
makefile
2
makefile
@ -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 $@
|
||||
|
||||
# --------------------------
|
||||
|
||||
11
timer.c
11
timer.c
@ -1,6 +1,12 @@
|
||||
#include "timer.h"
|
||||
|
||||
#if __APPLE__
|
||||
#ifdef __linux__
|
||||
// Defines strict posix compliance for CLOCK_MONOTONIC
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __linux__
|
||||
#include <sys/time.h>
|
||||
static struct timespec start = {0, 0};
|
||||
|
||||
@ -21,7 +27,8 @@ 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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user