get_seconds.cpp 473 B

1234567891011121314151617181920
  1. #include "get_seconds.h"
  2. #if _WIN32
  3. # include <ctime>
  4. IGL_INLINE double igl::get_seconds()
  5. {
  6. // This does not work on mac os x with glut in the main loop
  7. return double(clock())/CLOCKS_PER_SEC;
  8. }
  9. #else
  10. # include <sys/time.h>
  11. IGL_INLINE double igl::get_seconds()
  12. {
  13. timeval time;
  14. gettimeofday(&time, NULL);
  15. return time.tv_sec + time.tv_usec / 1e6;
  16. // This does not work on mac os x with glut in the main loop
  17. //return double(clock())/CLOCKS_PER_SEC;
  18. }
  19. #endif