mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
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.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#include "lib_timer.h"
|
||||
|
||||
#include "toy_common.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "toy_common.h"
|
||||
|
||||
//god damn it
|
||||
static struct timeval* diff(struct timeval* lhs, struct timeval* rhs) {
|
||||
|
||||
@@ -13,15 +13,17 @@
|
||||
#if defined(__linux__)
|
||||
#define TOY_API extern
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#elif defined(_WIN32) || defined(WIN32)
|
||||
#define TOY_API
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#else
|
||||
#define TOY_API
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user