Esempio n. 1
0
extern int clock_init(struct SPDR_Clock **clockp,
                      struct SPDR_Allocator *allocator)
{
        mach_timebase_info_data_t info;
        if (mach_timebase_info(&info)) {
                return -1;
        }

        return clock_init_base(clockp, allocator, info.numer,
                               info.denom * 1000);
}
Esempio n. 2
0
extern int clock_init(struct SPDR_Clock **clockp,
                      struct SPDR_Allocator *allocator)
{
        struct timespec res;

        if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
                /* unknown clock or insufficient resolution */
                return -1;
        }

        return clock_init_base(clockp, allocator, 1, 1000);
}