00001 #include <time.h>
00002 #include <sys/time.h>
00003 #include "timer.h"
00004 #include "types.h"
00005
00006
00007 namespace audiere {
00008
00009 u64 GetNow() {
00010
00011 #if HAVE_CLOCK_GETTIME
00012
00013 struct timespec tp;
00014 int result = clock_gettime(CLOCK_REALTIME, &tp);
00015 if (result == 0) {
00016 return u64(tp.tv_sec) * 1000000 + u64(tp.tv_nsec) / 1000;
00017 }
00018 #endif
00019
00020
00021 struct timeval tv;
00022 gettimeofday(&tv, 0);
00023 return u64(tv.tv_sec) * 1000000 + tv.tv_usec;
00024 }
00025
00026 }