Mercurial > hg > old > magoroku_racing
annotate mytype.c @ 95:b0249b856488
change_ps2util
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 May 2011 18:13:40 +0900 |
parents | 8edae89a3877 |
children | 0b65ca27f113 |
rev | line source |
---|---|
0 | 1 /* |
2 * $Id$ | |
3 */ | |
4 #include <time.h> | |
5 #include <stdio.h> | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
6 #include <stdbool.h> |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
7 //#include "libps2.h" |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
8 //#include "ps2util.h" |
0 | 9 #include "mytype.h" |
10 | |
11 static clock_t start; | |
12 static clock_t race_start; | |
13 | |
14 void | |
15 wait_init() | |
16 { | |
17 start = clock(); | |
18 } | |
19 | |
20 /* | |
88 | 21 * wait_init()から |
22 * time秒(マイクロ秒?)すぎたらTRUEを返す | |
0 | 23 */ |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
24 bool |
0 | 25 wait(double time) |
26 { | |
27 clock_t t; | |
28 double a; | |
29 | |
30 t = clock(); | |
31 a = (t-start)/(double)CLOCKS_PER_SEC; | |
32 if (a > time) { | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
33 return true; |
0 | 34 } |
35 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
36 return false; |
0 | 37 } |
38 | |
39 void | |
40 time_RaceStart() | |
41 { | |
42 race_start = clock(); | |
43 } | |
44 | |
45 double | |
46 time_RaceTime() | |
47 { | |
48 clock_t t; | |
49 double a; | |
50 | |
51 t = clock(); | |
52 a = (t-race_start)/(double)CLOCKS_PER_SEC; | |
53 | |
54 return a; | |
55 } |