2 % (c) The GRASP/AQUA Project, Glasgow University, 1995
4 \subsection[getClockTime.lc]{getClockTime Runtime Support}
9 #define NON_POSIX_SOURCE /* gettimeofday */
17 # ifdef HAVE_SYS_TIMERS_H
19 # include <sys/timers.h>
23 # ifdef HAVE_GETTIMEOFDAY
25 # ifdef HAVE_SYS_TIME_H
26 # include <sys/time.h>
39 getClockTime(StgByteArray sec, StgByteArray nsec)
44 if (getclock(TIMEOFDAY, &tp) != 0) {
49 ((unsigned long int *)sec)[0] = tp.tv_sec;
50 ((unsigned long int *)nsec)[0] = tp.tv_nsec;
53 #ifdef HAVE_GETTIMEOFDAY
56 if (gettimeofday(&tp, NULL) != 0) {
61 ((unsigned long int *)sec)[0] = tp.tv_sec;
62 ((unsigned long int *)nsec)[0] = tp.tv_usec * 1000;
66 if ((t = time(NULL)) == (time_t) -1) {
71 ((unsigned long int *)sec)[0] = t;
72 ((unsigned long int *)nsec)[0] = 0;