Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
810 B

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include <stdafx.h>
  8. static double beginTime;
  9. double I_FloatTime( void )
  10. {
  11. static double freq = 0.0;
  12. static __int64 firstCount;
  13. __int64 curCount;
  14. if (freq == 0.0)
  15. {
  16. __int64 perfFreq;
  17. QueryPerformanceFrequency( (LARGE_INTEGER*)&perfFreq );
  18. QueryPerformanceCounter( (LARGE_INTEGER*)&firstCount );
  19. freq = 1.0 / (double)perfFreq;
  20. }
  21. QueryPerformanceCounter ( (LARGE_INTEGER*)&curCount );
  22. curCount -= firstCount;
  23. double time = (double)curCount * freq;
  24. return time;
  25. }
  26. void I_BeginTime( void )
  27. {
  28. beginTime = I_FloatTime();
  29. }
  30. double I_EndTime( void )
  31. {
  32. return ( I_FloatTime() - beginTime );
  33. }