Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GETCLOCKTIMER_HPP
00020 #define GETCLOCKTIMER_HPP 1
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025
00026 #include <ctime>
00027
00028
00029 #if !defined(HAVE_CLOCK_GETTIME) && !defined(__OS2__)
00030
00031 #include <sys/time.h>
00032
00033 #ifdef HAVE_PTHREADS
00034 #include <pthread.h>
00035 #endif
00036
00037 #if defined WIN32 && !defined(HAVE_STRUCT_TIMESPEC)
00038 struct timespec {
00039 time_t tv_sec;
00040 long tv_nsec;
00041 };
00042 #endif
00043
00044 #define CLOCK_REALTIME 0
00045
00046 static int clock_gettime(int, struct timespec *tp) {
00047
00048 struct timeval now;
00049 int ret = gettimeofday(&now, NULL);
00050
00051 if (ret != 0)
00052 return ret;
00053
00054 tp->tv_sec = now.tv_sec;
00055 tp->tv_nsec = now.tv_usec * 1000;
00056 return 0;
00057 }
00058
00059 #endif
00060 #endif