Trying to fix time and platforms

This commit is contained in:
2022-11-11 17:31:45 +00:00
parent e0ab4106fa
commit 3d8ce4e7d8
2 changed files with 10 additions and 24 deletions

View File

@@ -3,30 +3,7 @@
#include "memory.h" #include "memory.h"
#include <stdio.h> #include <stdio.h>
#include <time.h> #include "toy_common.h"
#include <sys/time.h>
/*
//using time.h
var timer: opaque = startTimer();
var diff: opaque = timer.stopTimer();
...
var timer = createTimer(seconds, microseconds);
print timer.getTimerSeconds();
print timer.getTimerMicroseconds();
...
var diff: opaque = timer.compareTimers(rhs); //expects another timer
...
print timer.timerToString(); //string representation of the timer
timer.destroyTimer(); //needed to free the memory
*/
//god damn it //god damn it
static struct timeval* diff(struct timeval* lhs, struct timeval* rhs) { static struct timeval* diff(struct timeval* lhs, struct timeval* rhs) {

View File

@@ -12,8 +12,17 @@
//platform exports/imports //platform exports/imports
#if defined(__linux__) #if defined(__linux__)
#define TOY_API extern #define TOY_API extern
#include <time.h>
#elif defined(_WIN32) || defined(WIN32)
#define TOY_API
#include <sys/time.h>
#include <time.h>
#else #else
#define TOY_API #define TOY_API
#include <time.h>
#endif #endif
#ifndef TOY_EXPORT #ifndef TOY_EXPORT