get_seconds.h 254 B

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