2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: getClockTime.c,v 1.1 1998/04/10 10:54:35 simonm Exp $
6 * getClockTime Runtime Support
10 #define NON_POSIX_SOURCE /* gettimeofday */
18 # ifdef HAVE_SYS_TIMERS_H
20 # include <sys/timers.h>
24 # ifdef HAVE_GETTIMEOFDAY
26 # ifdef HAVE_SYS_TIME_H
27 # include <sys/time.h>
40 getClockTime(StgByteArray sec, StgByteArray nsec)
45 if (getclock(TIMEOFDAY, &tp) != 0) {
50 ((unsigned long int *)sec)[0] = tp.tv_sec;
51 ((unsigned long int *)nsec)[0] = tp.tv_nsec;
54 #ifdef HAVE_GETTIMEOFDAY
57 if (gettimeofday(&tp, NULL) != 0) {
62 ((unsigned long int *)sec)[0] = tp.tv_sec;
63 ((unsigned long int *)nsec)[0] = tp.tv_usec * 1000;
67 if ((t = time(NULL)) == (time_t) -1) {
72 ((unsigned long int *)sec)[0] = t;
73 ((unsigned long int *)nsec)[0] = 0;