Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

timer_posix.cpp

Go to the documentation of this file.
00001 #include <time.h>
00002 #include <sys/time.h>
00003 #include "timer.hpp"
00004 
00005 
00006 adr_u64 GetNow() {
00007 
00008 #if HAVE_CLOCK_GETTIME
00009   // use the POSIX realtime clock to get the current time
00010   struct timespec tp;
00011   int result = clock_gettime(CLOCK_REALTIME, &tp);
00012   if (result == 0) {
00013     return adr_u64(tp.tv_sec) * 1000000 + adr_u64(tp.tv_nsec) / 1000;
00014   }
00015 #endif
00016 
00017   // can't use realtime clock!  Try to use gettimeofday
00018   struct timeval tv;
00019   gettimeofday(&tv, 0);
00020   return adr_u64(tv.tv_sec) * 1000000 + tv.tv_usec;
00021 }

Generated at Mon Jun 10 02:55:13 2002 for audiere by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001