Mercurial > hg > old > magoroku_racing
diff mytype.c @ 0:0fae5658fb0b
Initial revision
author | gongo |
---|---|
date | Thu, 02 Nov 2006 08:55:19 +0000 |
parents | |
children | ce9ef7dcf2f0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mytype.c Thu Nov 02 08:55:19 2006 +0000 @@ -0,0 +1,54 @@ +/* + * $Id$ + */ +#include <time.h> +#include <stdio.h> +#include "libps2.h" +#include "ps2util.h" +#include "mytype.h" + +static clock_t start; +static clock_t race_start; + +void +wait_init() +{ + start = clock(); +} + +/* + * wait_init()から + * time秒(マイクロ秒?)すぎたらTRUEを返す + */ +Bool +wait(double time) +{ + clock_t t; + double a; + + t = clock(); + a = (t-start)/(double)CLOCKS_PER_SEC; + if (a > time) { + return TRUE; + } + + return FALSE; +} + +void +time_RaceStart() +{ + race_start = clock(); +} + +double +time_RaceTime() +{ + clock_t t; + double a; + + t = clock(); + a = (t-race_start)/(double)CLOCKS_PER_SEC; + + return a; +}