Something went wrong on our end
util.cpp 6.07 KiB
/*
* util.c - Contains all of the timing functions for various platforms.
*
* $Id: util.c,v 1.1.1.1 2013/05/30 22:18:41 awknaust1 Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "util.h"
#if defined(__PARAGON__) || defined(__IPSC__)
#if defined(__IPSC__)
#include <cube.h>
#endif /* iPSC/860 specific */
#if defined(__PARAGON__)
#include <nx.h>
#endif /* Paragon XP/S specific */
#include <estat.h>
#endif /* iPSC/860 and Paragon specific items */
/* most platforms will use the regular time function gettimeofday() */
#if !defined(__IPSC__) && !defined(__PARAGON__) && !defined(NEXT)
#define STDTIME
#endif
#if defined(NEXT)
#include <time.h>
#undef STDTIME
#define OLDUNIXTIME
#endif
#if defined(_MSC_VER) || defined(WIN32)
#include <windows.h>
#undef STDTIME
#define WIN32GETTICKCOUNT
#endif
#if defined(__linux) || defined(Bsd) || defined(AIX) || defined(SunOS) || defined(HPUX) || defined(_CRAYT3E) || defined(_CRAY) || defined(_CRAYC) || defined(__osf__) || defined(__BEOS__) || defined(__APPLE__) || defined(__irix)
#include <sys/time.h>
#endif
#if defined(MCOS) || defined(VXWORKS)
#define POSIXTIME
#endif
#if defined(WIN32GETTICKCOUNT)
typedef struct {
DWORD starttime;
DWORD endtime;
} rt_timer;
void rt_timer_start(rt_timerhandle v) {
rt_timer * t = (rt_timer *) v;
t->starttime = GetTickCount();
}
void rt_timer_stop(rt_timerhandle v) {
rt_timer * t = (rt_timer *) v;
t->endtime = GetTickCount();
}
double rt_timer_time(rt_timerhandle v) {