FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
time_timer.c
Go to the documentation of this file.
1
/* timer() function */
2
3
#include "../fb.h"
4
#include <time.h>
5
#include <windows.h>
6
7
#define TIMER_NONE 0
8
#define TIMER_NORMAL 1
9
#define TIMER_HIGHRES 2
10
static
int
timer
=
TIMER_NONE
;
11
static
double
frequency
;
12
13
FBCALL
double
fb_Timer
(
void
)
14
{
15
LARGE_INTEGER count;
16
17
if
(
timer
==
TIMER_NONE
) {
18
if
( QueryPerformanceFrequency( &count ) ) {
19
frequency
= 1.0 / (double)count.QuadPart;
20
timer
=
TIMER_HIGHRES
;
21
}
else
{
22
timer
=
TIMER_NORMAL
;
23
}
24
}
25
26
if
(
timer
==
TIMER_NORMAL
) {
27
return
(
double
)GetTickCount( ) * 0.001;
28
}
else
{
29
QueryPerformanceCounter( &count );
30
return
(
double
)count.QuadPart *
frequency
;
31
}
32
}
rtlib
win32
time_timer.c
Generated on Thu Jan 23 2014 19:40:10 for FreeBASIC by
1.8.4