timer.c 2.0 KB

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