linuxstuff.cpp 892 Bytes

#include <unistd.h>
#include <sys/time.h>
#include "dependencies.h"
   
int kernelInit(void)
{
  return 1; 
}

void WaitForKeyboard(void)
{
}
   

void common_sleep(unsigned int  mseconds )
{
    // 1 milliseconds = 1000 microsecond.
    // Windows Sleep uses miliseconds
    // linux usleep uses microsecond
    // and since the default
    // usage of the code was under windows 
    // so the argument is   coming in millisecond.
    usleep( mseconds * 1000 );
}

/* Time functions */

//#include <rtl_time.h> 

status_t
initftime(void) {
	// nothing
	return B_OK;
}
// you would have to start up with initftime() at the beginning
// of the game. And check for errors


bigtime_t
system_time (void)     /* time since booting in microseconds */
{
//	return (bigtime_t)gethrtime();
	timeval tv;
	timezone tz;
	gettimeofday (&tv, &tz);
	return (bigtime_t)tv.tv_sec * 1000000 + tv.tv_usec;
}