view mytype.cc @ 99:c534f339ee8b

change c++
author e085768
date Thu, 02 Jun 2011 17:51:41 +0900
parents mytype.c@0b65ca27f113
children
line wrap: on
line source

/*  mytype.c */

#include <time.h>
#include <stdio.h>
#include <stdbool.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;
}