0
|
1 /*
|
|
2 * $Id$
|
|
3 */
|
|
4 #include <time.h>
|
|
5 #include <stdio.h>
|
|
6 #include "libps2.h"
|
|
7 #include "ps2util.h"
|
|
8 #include "mytype.h"
|
|
9
|
|
10 static clock_t start;
|
|
11 static clock_t race_start;
|
|
12
|
|
13 void
|
|
14 wait_init()
|
|
15 {
|
|
16 start = clock();
|
|
17 }
|
|
18
|
|
19 /*
|
|
20 * wait_init()から
|
|
21 * time秒(マイクロ秒?)すぎたらTRUEを返す
|
|
22 */
|
|
23 Bool
|
|
24 wait(double time)
|
|
25 {
|
|
26 clock_t t;
|
|
27 double a;
|
|
28
|
|
29 t = clock();
|
|
30 a = (t-start)/(double)CLOCKS_PER_SEC;
|
|
31 if (a > time) {
|
|
32 return TRUE;
|
|
33 }
|
|
34
|
|
35 return FALSE;
|
|
36 }
|
|
37
|
|
38 void
|
|
39 time_RaceStart()
|
|
40 {
|
|
41 race_start = clock();
|
|
42 }
|
|
43
|
|
44 double
|
|
45 time_RaceTime()
|
|
46 {
|
|
47 clock_t t;
|
|
48 double a;
|
|
49
|
|
50 t = clock();
|
|
51 a = (t-race_start)/(double)CLOCKS_PER_SEC;
|
|
52
|
|
53 return a;
|
|
54 }
|