Sha256: 8e8b4cbfa5812882190a10cae64ba768f959aff7dbd38800600fff14b9ccc9d6

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

#include <Gosu/Platform.hpp>
#if defined(GOSU_IS_MAC)

#include <Gosu/Timing.hpp>

// Thanks to this blog for the unconvoluted code example:
// http://shiftedbits.org/2008/10/01/mach_absolute_time-on-the-iphone/

#include <mach/mach_time.h>

unsigned long Gosu::milliseconds()
{
    static mach_timebase_info_data_t info;
    static uint64_t first_tick = [] {
        mach_timebase_info(&info);
        return mach_absolute_time();
    }();

    uint64_t runtime = mach_absolute_time() - first_tick;
    return runtime * info.numer / info.denom / 1000000;
}

#endif

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gosu-1.4.3 src/TimingApple.cpp