Update of /cvsroot/q-lang/q/src
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5741/src
Modified Files:
sys.c
Log Message:
add support for highres timers
Index: sys.c
===================================================================
RCS file: /cvsroot/q-lang/q/src/sys.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sys.c 22 Feb 2008 11:55:51 -0000 1.3
--- sys.c 22 Feb 2008 12:55:29 -0000 1.4
***************
*** 166,169 ****
--- 166,194 ----
}
+ #ifdef HAVE_CLOCK_GETTIME
+
+ double systime(void)
+ {
+ struct timespec tv;
+ int res = clock_gettime(CLOCK_REALTIME, &tv);
+ if (res)
+ return 0.0;
+ else
+ return ((double)tv.tv_sec)+((double)tv.tv_nsec)*1e-9;
+ }
+
+ #else
+
+ #ifdef HAVE_GETTIMEOFDAY
+
+ double systime(void)
+ {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return ((double)tv.tv_sec)+((double)tv.tv_usec)*1e-6;
+ }
+
+ #else
+
#ifdef HAVE_FTIME
***************
*** 186,189 ****
--- 211,218 ----
#endif
+ #endif
+
+ #endif
+
#ifndef _WIN32
|