- struct timeval tp;
- gettimeofday(&tp, NULL);
- newtime = (double) tp.tv_sec + tp.tv_usec / 1000000.0;
+# ifndef MACOSX
+ if (sys_useclockgettime.integer)
+ {
+ struct timespec ts;
+# ifdef SUNOS
+ clock_gettime(CLOCK_HIGHRES, &ts);
+# else
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+# endif
+ newtime = (double) ts.tv_sec + ts.tv_nsec / 1000000000.0;
+ }
+ else
+# endif
+ {
+ struct timeval tp;
+ gettimeofday(&tp, NULL);
+ newtime = (double) tp.tv_sec + tp.tv_usec / 1000000.0;
+ }