mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
Improving Time Elapsed logic
This commit is contained in:
parent
e24b061c61
commit
dfd5409922
@ -86,13 +86,18 @@ KanjiSpineExtension::KanjiSpineExtension() : DefaultSpineExtension()
|
|||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double timeNow()
|
||||||
|
{
|
||||||
|
timespec lTimeVal;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &lTimeVal);
|
||||||
|
return lTimeVal.tv_sec + (lTimeVal.tv_nsec * 1.0e-9);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
SpineExtension::setInstance(KanjiSpineExtension::getInstance());
|
SpineExtension::setInstance(KanjiSpineExtension::getInstance());
|
||||||
|
|
||||||
// Start Timing
|
double startTime = timeNow();
|
||||||
time_t start_time, end_time;
|
|
||||||
time(&start_time);
|
|
||||||
|
|
||||||
/* Set working directory to current location for opening test data */
|
/* Set working directory to current location for opening test data */
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -105,9 +110,10 @@ int main(int argc, char* argv[])
|
|||||||
MemoryTest::test();
|
MemoryTest::test();
|
||||||
|
|
||||||
// End Timing
|
// End Timing
|
||||||
time(&end_time);
|
double endTime = timeNow();
|
||||||
double secs = difftime(end_time,start_time);
|
double timeElapsed = (endTime - startTime);
|
||||||
printf("\n\n%i minutes and %i seconds of your life taken from you by these tests.\n", ((int)secs) / 60, ((int)secs) % 60);
|
printf("\n\n%i minutes and %i seconds of your life taken from you by these tests.\n", ((int)timeElapsed) / 60, ((int)timeElapsed) % 60);
|
||||||
|
printf("timeElapsed: %f \n", timeElapsed);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user