blob: 3031ef56db0518795f103d7fe7faeb448e63d225 [file] [log] [blame]
DRC2e7b76b2009-04-03 12:04:24 +00001/* Copyright (C)2004 Landmark Graphics Corporation
2 * Copyright (C)2005 Sun Microsystems, Inc.
3 *
4 * This library is free software and may be redistributed and/or modified under
5 * the terms of the wxWindows Library License, Version 3.1 or (at your option)
6 * any later version. The full license is in the LICENSE.txt file included
7 * with this distribution.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * wxWindows Library License for more details.
13 */
14
15#ifndef __RRTIMER_H__
16#define __RRTIMER_H__
17
DRC2e7b76b2009-04-03 12:04:24 +000018#ifdef _WIN32
19
20#include <windows.h>
21
22__inline double rrtime(void)
23{
24 LARGE_INTEGER Frequency, Time;
25 if(QueryPerformanceFrequency(&Frequency)!=0)
26 {
27 QueryPerformanceCounter(&Time);
28 return (double)Time.QuadPart/(double)Frequency.QuadPart;
29 }
30 else return (double)GetTickCount()*0.001;
31}
32
33#else
34
35#include <sys/time.h>
36
37#ifdef sun
38#define __inline inline
39#endif
40
41static __inline double rrtime(void)
42{
43 struct timeval __tv;
44 gettimeofday(&__tv, (struct timezone *)NULL);
45 return((double)__tv.tv_sec+(double)__tv.tv_usec*0.000001);
46}
47
48#endif
49
50#endif