From 30b068fcdbaa7c4271bfebaa7ee22b80c8545ac5 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 12 Nov 2022 04:45:35 +1100 Subject: [PATCH] Fixed timer issues, tests should pass Reduced test duration by a factor of 11,000. Don't ask. Also, something funny is going on with the time headers, so I stuck them into source/toy_common.h, I'll figure it out later. --- repl/lib_timer.c | 2 +- source/toy_common.h | 4 +++- test/scripts/lib/timer.toy | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/repl/lib_timer.c b/repl/lib_timer.c index 240e4cc..9604963 100644 --- a/repl/lib_timer.c +++ b/repl/lib_timer.c @@ -1,9 +1,9 @@ #include "lib_timer.h" +#include "toy_common.h" #include "memory.h" #include -#include "toy_common.h" //god damn it static struct timeval* diff(struct timeval* lhs, struct timeval* rhs) { diff --git a/source/toy_common.h b/source/toy_common.h index 30eea44..f02887f 100644 --- a/source/toy_common.h +++ b/source/toy_common.h @@ -13,15 +13,17 @@ #if defined(__linux__) #define TOY_API extern #include +#include #elif defined(_WIN32) || defined(WIN32) #define TOY_API -#include #include +#include #else #define TOY_API #include +#include #endif diff --git a/test/scripts/lib/timer.toy b/test/scripts/lib/timer.toy index c54d80e..928844f 100644 --- a/test/scripts/lib/timer.toy +++ b/test/scripts/lib/timer.toy @@ -4,12 +4,12 @@ import timer; var timerA: opaque = startTimer(); - for (var i: int = 0; i < 1000 * 1000; i++); + for (var i: int = 0; i < 1000 * 1; i++); var diffA: opaque = timerA.stopTimer(); //create another timer, run it for a longer period var timerB: opaque = startTimer(); - for (var i: int = 0; i < 1000 * 1000 * 10; i++); + for (var i: int = 0; i < 1000 * 10; i++); var diffB: opaque = timerB.stopTimer(); //check to ensure that the second timer took longer than the first