get_seconds.h 328 B

1234567891011121314151617181920
  1. #ifndef IGL_GET_SECONDS_H
  2. #define IGL_GET_SECONDS_H
  3. #include <sys/time.h>
  4. namespace igl
  5. {
  6. // Return the current time since Epoch in seconds
  7. inline double get_seconds();
  8. }
  9. //Implementation
  10. inline double igl::get_seconds()
  11. {
  12. timeval time;
  13. gettimeofday(&time, NULL);
  14. return time.tv_sec + time.tv_usec / 1e6;
  15. }
  16. #endif