mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
- Better timer for Windows platforms
- Made alarmed volatile for better Windows compatibility
This commit is contained in:
@ -39,7 +39,7 @@ struct hr_time
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int alarmed;
|
extern volatile int alarmed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return the CPU cycle counter value
|
* \brief Return the CPU cycle counter value
|
||||||
|
@ -136,6 +136,18 @@ unsigned long hardclock( void )
|
|||||||
return( itc );
|
return( itc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
|
unsigned long hardclock( void )
|
||||||
|
{
|
||||||
|
LARGE_INTEGER offset;
|
||||||
|
|
||||||
|
QueryPerformanceCounter( &offset );
|
||||||
|
|
||||||
|
return (unsigned long)( offset.QuadPart );
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static int hardclock_init = 0;
|
static int hardclock_init = 0;
|
||||||
@ -157,6 +169,7 @@ unsigned long hardclock( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* generic */
|
#endif /* generic */
|
||||||
|
#endif /* WIN32 */
|
||||||
#endif /* IA-64 */
|
#endif /* IA-64 */
|
||||||
#endif /* Alpha */
|
#endif /* Alpha */
|
||||||
#endif /* SPARC8 */
|
#endif /* SPARC8 */
|
||||||
@ -164,7 +177,7 @@ unsigned long hardclock( void )
|
|||||||
#endif /* AMD64 */
|
#endif /* AMD64 */
|
||||||
#endif /* i586+ */
|
#endif /* i586+ */
|
||||||
|
|
||||||
int alarmed = 0;
|
volatile int alarmed = 0;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user