Gnash
0.8.10
|
00001 // 00002 // Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 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 // TODO: why doesn't OS2 define HAVE_CLOCK_GETTIME? 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; /* seconds */ 00040 long tv_nsec; /* nanoseconds */ 00041 }; 00042 #endif 00043 00044 #define CLOCK_REALTIME 0 /* Dummy */ 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