timer.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifdef __cplusplus
  2. extern "C" {
  3. #endif
  4. //===============================================================================================================================================================================================================200
  5. // INCLUDE/DEFINE
  6. //===============================================================================================================================================================================================================200
  7. #include <stdlib.h>
  8. //===============================================================================================================================================================================================================200
  9. // INCLUDE HEADER
  10. //===============================================================================================================================================================================================================200
  11. #include "./timer.h"
  12. //===============================================================================================================================================================================================================200
  13. // TIMER FUNCTION
  14. //===============================================================================================================================================================================================================200
  15. // Returns the current system time in microseconds
  16. long long get_time() {
  17. struct timeval tv;
  18. gettimeofday(&tv, NULL);
  19. return (tv.tv_sec * 1000000) + tv.tv_usec;
  20. }
  21. //===============================================================================================================================================================================================================200
  22. // END
  23. //===============================================================================================================================================================================================================200
  24. #ifdef __cplusplus
  25. }
  26. #endif