Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@355 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-02-08 01:18:37 +00:00
parent daae6d966a
commit 2e4d044cab
7 changed files with 30 additions and 109 deletions

View File

@@ -15,69 +15,6 @@
#ifndef __RRTIMER_H__
#define __RRTIMER_H__
#ifdef __cplusplus
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/time.h>
#endif
class rrtimer
{
public:
rrtimer(void) : t1(0.0)
{
#ifdef _WIN32
highres=false; tick=0.001;
LARGE_INTEGER Frequency;
if(QueryPerformanceFrequency(&Frequency)!=0)
{
tick=(double)1.0/(double)(Frequency.QuadPart);
highres=true;
}
#endif
}
void start(void)
{
t1=time();
}
double time(void)
{
#ifdef _WIN32
if(highres)
{
LARGE_INTEGER Time;
QueryPerformanceCounter(&Time);
return((double)(Time.QuadPart)*tick);
}
else
return((double)GetTickCount()*tick);
#else
struct timeval __tv;
gettimeofday(&__tv, (struct timezone *)NULL);
return((double)(__tv.tv_sec)+(double)(__tv.tv_usec)*0.000001);
#endif
}
double elapsed(void)
{
return time()-t1;
}
private:
#ifdef _WIN32
bool highres; double tick;
#endif
double t1;
};
#endif // __cplusplus
#ifdef _WIN32
#include <windows.h>
@@ -111,4 +48,3 @@ static __inline double rrtime(void)
#endif
#endif