forked from freudenreichan/info2Praktikum-DobleSpiel
adding content
This commit is contained in:
commit
d0f2ee5760
56 files changed
+15217
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#include <time.h>
|
||||
#include "timer.h"
|
||||
|
||||
static clock_t startClocks = 0;
|
||||
|
||||
// Starts the timer.
|
||||
void startTimer()
|
||||
{
|
||||
startClocks = clock();
|
||||
}
|
||||
|
||||
// Returns the time in seconds since startTimer() was called.
|
||||
double stopTimer()
|
||||
{
|
||||
double measuredSeconds = (clock() - (double)startClocks) / CLOCKS_PER_SEC;
|
||||
|
||||
if(startClocks > 0)
|
||||
startClocks = 0;
|
||||
else
|
||||
measuredSeconds = -1;
|
||||
|
||||
return measuredSeconds;
|
||||
}
|
||||
Reference in new issue
Block a user