1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-24 00:51:05 +00:00

Do not try to use clock_gettime() on OSX

This commit is contained in:
jsteube 2016-06-12 18:07:26 +02:00
parent 7ef80fb12b
commit 217f9e6004

View File

@ -5425,7 +5425,20 @@ static uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, cons
* main * main
*/ */
#ifdef _WIN #ifdef LINUX
int (*clock_gettime_orig) (clockid_t clk_id, struct timespec *tp);
int clock_gettime (clockid_t clk_id, struct timespec *tp)
{
int r = clock_gettime_orig (clk_id, tp);
usleep (NVIDIA_100PERCENTCPU_WORKAROUND);
return r;
}
#endif
#ifdef WIN
void SetConsoleWindowSize (const int x) void SetConsoleWindowSize (const int x)
{ {
HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE); HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE);
@ -5451,26 +5464,13 @@ void SetConsoleWindowSize (const int x)
} }
#endif #endif
#ifdef _POSIX
int (*clock_gettime_orig) (clockid_t clk_id, struct timespec *tp);
int clock_gettime (clockid_t clk_id, struct timespec *tp)
{
int r = clock_gettime_orig (clk_id, tp);
usleep (NVIDIA_100PERCENTCPU_WORKAROUND);
return r;
}
#endif
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
#ifdef _POSIX #ifdef LINUX
clock_gettime_orig = dlsym (RTLD_NEXT, "clock_gettime"); clock_gettime_orig = dlsym (RTLD_NEXT, "clock_gettime");
#endif #endif
#ifdef _WIN #ifdef WIN
SetConsoleWindowSize (132); SetConsoleWindowSize (132);
#endif #endif