1 /* 2 * E-UAE - The portable Amiga Emulator 3 * 4 * Generic high-resolution timer support. 5 * 6 * (c) 2005 Richard Drummond 7 */ 8 9 #ifndef EUAE_OSDEP_HRTIMER_H 10 #define EUAE_OSDEP_HRTIMER_H 11 #ifdef WIIU 12 #include <features_cpu.h> 13 #endif 14 #ifdef __CELLOS_LV2__ 15 #include "sys/sys_time.h" 16 #include "sys/timer.h" 17 #define usleep sys_timer_usleep 18 gettimeofday(struct timeval * tv,void * blah)19static INLINE void gettimeofday (struct timeval *tv, void *blah) 20 { 21 int64_t time = sys_time_get_system_time(); 22 23 tv->tv_sec = time / 1000000; 24 tv->tv_usec = time - (tv->tv_sec * 1000000); // implicit rounding will take care of this for us 25 } 26 #else 27 #include <sys/types.h> 28 #include <sys/time.h> 29 #include <time.h> 30 #endif 31 32 #ifdef VITA 33 #include <psp2/kernel/processmgr.h> 34 #define usleep sceKernelDelayThreadCB; 35 #endif 36 37 #include "machdep/rpt.h" 38 39 osdep_gethrtime(void)40STATIC_INLINE frame_time_t osdep_gethrtime (void) 41 { 42 #ifndef _ANDROID_ 43 44 #ifdef WIIU 45 return cpu_features_get_time_usec(); 46 #else 47 struct timeval tv; 48 gettimeofday (&tv, NULL); 49 return tv.tv_sec*1000000 + tv.tv_usec; 50 #endif 51 52 #else 53 #define osd_ticks_t uae_s64 54 struct timeval tp; 55 static osd_ticks_t start_sec1 = 0; 56 57 gettimeofday(&tp, NULL); 58 if (start_sec1==0) 59 start_sec1 = tp.tv_sec; 60 return (tp.tv_sec - start_sec1) * (osd_ticks_t) 1000000 + tp.tv_usec; 61 #endif 62 } 63 osdep_gethrtimebase(void)64STATIC_INLINE frame_time_t osdep_gethrtimebase (void) 65 { 66 return 1000000; 67 } 68 osdep_inithrtimer(void)69STATIC_INLINE void osdep_inithrtimer (void) 70 { 71 } 72 #endif 73