Sha256: 4c77ce3f64f787e2eb5c17cf97ec28e0e531f860fb653495e52ba41071dbaa49
Contents?: true
Size: 630 Bytes
Versions: 54
Compression:
Stored size: 630 Bytes
Contents
#include <Gosu/Timing.hpp> #include <unistd.h> void Gosu::sleep(unsigned milliseconds) { usleep(milliseconds * 1000); } // 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 uint64_t firstTick = 0; static mach_timebase_info_data_t info; if (firstTick == 0) { mach_timebase_info(&info); firstTick = mach_absolute_time(); } uint64_t runtime = mach_absolute_time() - firstTick; return runtime * info.numer / info.denom / 1000000.0; }
Version data entries
54 entries across 54 versions & 1 rubygems