timer.c 1.6 KB

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