1 /* vclock.c - high-precision wall clock time 2 * 3 * Copyright 1998 Jochen Voss. */ 4 5 static const char rcsid[] = "$Id: vclock.c 5726 2004-06-01 21:22:28Z voss $"; 6 7 8 #ifdef HAVE_CONFIG_H 9 #include <config.h> 10 #endif 11 12 #ifdef _XOPEN_SOURCE 13 #define _XOPEN_SOURCE_EXTENDED 1 14 #endif 15 16 #include <sys/time.h> 17 18 #if defined(__hp9000s800) 19 #include <stdarg.h> 20 #endif 21 22 #include "moon-buggy.h" 23 24 25 double vclock(void)26vclock (void) 27 /* Return the elapsed (wall clock) time (measured in seconds) since 28 * some base time with greater precision than `time()' does. */ 29 { 30 struct timeval x; 31 32 gettimeofday (&x, NULL); 33 return (x.tv_sec + x.tv_usec*1.0e-6); 34 } 35