Sha256: 14e8a96234c218660892e4627e052c1a7a6b28822552ca97ef2a36f3411294be
Contents?: true
Size: 654 Bytes
Versions: 29
Compression:
Stored size: 654 Bytes
Contents
#include <Gosu/Timing.hpp> #include <windows.h> #include <cstdlib> void Gosu::sleep(unsigned milliseconds) { ::Sleep(milliseconds); } namespace { void resetTGT() { ::timeEndPeriod(1); } } unsigned long Gosu::milliseconds() { static unsigned long start = 0; if (!start) { if (::timeBeginPeriod(1) != TIMERR_NOERROR) std::atexit(resetTGT); start = ::timeGetTime(); } // Truncate to 2^30, C++ users shouldn't mind and Ruby users will // have a happy GC on 32-bit systems. // No, don't ask why this is an unsigned long then :) return (::timeGetTime() - start) & 0x1fffffff; }
Version data entries
29 entries across 29 versions & 1 rubygems