8 #if defined(ABT_CONFIG_USE_MACH_ABSOLUTE_TIME) 9 static double g_time_mult = 0.0;
11 void ABTD_time_init(
void)
13 #if defined(ABT_CONFIG_USE_MACH_ABSOLUTE_TIME) 14 mach_timebase_info_data_t info;
15 mach_timebase_info(&info);
16 g_time_mult = 1.0e-9 * ((double)info.numer / (
double)info.denom);
21 int ABTD_time_get(ABTD_time *p_time)
25 #if defined(ABT_CONFIG_USE_CLOCK_GETTIME) 26 clock_gettime(CLOCK_REALTIME, p_time);
27 #elif defined(ABT_CONFIG_USE_MACH_ABSOLUTE_TIME) 28 *p_time = mach_absolute_time();
29 #elif defined(ABT_CONFIG_USE_GETTIMEOFDAY) 30 gettimeofday(p_time, NULL);
37 double ABTD_time_read_sec(ABTD_time *p_time)
41 #if defined(ABT_CONFIG_USE_CLOCK_GETTIME) 42 secs = ((double)p_time->tv_sec) + 1.0e-9 * ((double)p_time->tv_nsec);
43 #elif defined(ABT_CONFIG_USE_MACH_ABSOLUTE_TIME) 44 if (g_time_mult == 0.0)
46 secs = *p_time * g_time_mult;
47 #elif defined(ABT_CONFIG_USE_GETTIMEOFDAY) 48 secs = ((double)p_time->tv_sec) + 1.0e-6 * ((double)p_time->tv_usec);