mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-27 02:18:21 +00:00
30 lines
811 B
C
30 lines
811 B
C
|
/**
|
||
|
* Authors.....: Jens Steube <jens.steube@gmail.com>
|
||
|
* License.....: MIT
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#ifdef _POSIX
|
||
|
#include <sys/time.h>
|
||
|
#else
|
||
|
#endif
|
||
|
|
||
|
#ifdef _WIN
|
||
|
typedef LARGE_INTEGER hc_timer_t;
|
||
|
#elif _POSIX
|
||
|
typedef struct timeval hc_timer_t;
|
||
|
#endif
|
||
|
|
||
|
#ifdef _WIN
|
||
|
|
||
|
#define hc_timer_get(a,r) { hc_timer_t hr_freq; QueryPerformanceFrequency (&hr_freq); hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) ((double) (hr_tmp.QuadPart - (a).QuadPart) / (double) (hr_freq.QuadPart / 1000)); }
|
||
|
#define hc_timer_set(a) { QueryPerformanceCounter ((a)); }
|
||
|
|
||
|
#elif _POSIX
|
||
|
|
||
|
#define hc_timer_get(a,r) { hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) (((hr_tmp.tv_sec - (a).tv_sec) * 1000) + ((double) (hr_tmp.tv_usec - (a).tv_usec) / 1000)); }
|
||
|
#define hc_timer_set(a) { gettimeofday ((a), NULL); }
|
||
|
|
||
|
#endif
|