Expanding out ideas on Simulator 2... trying to get everything working

This commit is contained in:
Charles Descamps 2024-02-15 12:34:23 -07:00
parent 93904cb2f3
commit 62418ec35a
5 changed files with 138 additions and 12 deletions

View file

@ -28,8 +28,9 @@
// Constants /////////////////////////////////////////////////////////////////
const char RADIX_POINT = '.';
const char SPACED = ' ';
void runTimer( int milliSeconds )
void *runTimer( int milliSeconds )
{
struct timeval startTime, endTime;
int startSec, startUSec, endSec, endUSec;
@ -61,11 +62,12 @@ void runTimer( int milliSeconds )
secDiff = ( endSec - startSec ) * 1000;
timeDiff = secDiff + mSecDiff;
}
return NULL;
}
double accessTimer( int controlCode, char *timeStr )
{
static Boolean running = False;
static bool running = false;
static int startSec = 0, endSec = 0, startUSec = 0, endUSec = 0;
static int lapSec = 0, lapUSec = 0;
struct timeval startData, lapData, endData;
@ -75,7 +77,7 @@ double accessTimer( int controlCode, char *timeStr )
{
case ZERO_TIMER:
gettimeofday( &startData, NULL );
running = True;
running = true;
startSec = startData.tv_sec;
startUSec = startData.tv_usec;
@ -88,7 +90,7 @@ double accessTimer( int controlCode, char *timeStr )
break;
case LAP_TIMER:
if( running == True )
if( running == true )
{
gettimeofday( &lapData, NULL );
@ -106,10 +108,10 @@ double accessTimer( int controlCode, char *timeStr )
break;
case STOP_TIMER:
if( running == True )
if( running == true )
{
gettimeofday( &endData, NULL );
running = False;
running = false;
endSec = endData.tv_sec;
endUSec = endData.tv_usec;