X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/b04fe171f0375ecd5d8a24747ca1dff85720a0ca..6b200bc335dc93c5516ccb52f14bd896d8c7fad7:/SecurityTests/clxutils/threadTest/timeThread.cpp diff --git a/SecurityTests/clxutils/threadTest/timeThread.cpp b/SecurityTests/clxutils/threadTest/timeThread.cpp deleted file mode 100644 index ba060c65..00000000 --- a/SecurityTests/clxutils/threadTest/timeThread.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* quick time() and gmtime() tester. */ -/* As of Dec. 20, 2000, this test demonstrates that stdlib time() is thread-safe, but - * gmtime() is NOT thread safe. */ -#include -#include -#include "testParams.h" -#include -#include - -#define DO_CF_TIME 1 -#define DO_TIME_LOCK 1 - -#if DO_CF_TIME -int timeInit(TestParams *tp) -{ - return 0; -} - -#define INNER_LOOPS 100 - -int timeThread(TestParams *tp) -{ - CFAbsoluteTime cfTimes[INNER_LOOPS]; - - for(unsigned dex=0; dexnumLoops; dex++) { - if(tp->verbose) { - printf("timeThread loop %u\n", dex); - } - else if(!tp->quiet) { - printChar(tp->progressChar); - } - - for(unsigned innerLoop=0; innerLoopnumLoops); dex++) { - time_t nowTime; - struct tm nowTm; - nowTime = time(NULL); - #if DO_TIME_LOCK - timeLock.lock(); - #endif - nowTm = *gmtime(&nowTime); - #if DO_TIME_LOCK - timeLock.unlock(); - #endif - if(nowTime < baseTime) { - printf("\n***time() went backwards: base %d now %d\n", - (int)baseTime, (int)nowTime); - return 1; - } - if((nowTm.tm_year < baseTm.tm_year) || - (nowTm.tm_mon < baseTm.tm_mon) || - (nowTm.tm_mday < baseTm.tm_mday) || - /* careful, this overflows at midnight */ - (nowTm.tm_hour < baseTm.tm_hour)) { - printf("\n***gmtime() went backwards\n"); - printf(" baseTm y:%d m:%d d:%d h:%d m:%d\n", - baseTm.tm_year, baseTm.tm_mon, baseTm.tm_mday, - baseTm.tm_hour, baseTm.tm_min); - printf(" nowTm y:%d m:%d d:%d h:%d m:%d\n", - nowTm.tm_year, nowTm.tm_mon, nowTm.tm_mday, - nowTm.tm_hour, nowTm.tm_min); - return 1; - } - if(((dex % 100) == 0) && !tp->quiet) { - printChar(tp->progressChar); - } - } - return 0; -} - -#endif /* DO_CF_TIME */