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

Version Path
gosu-0.9.1 src/TimingWin.cpp
gosu-0.9.0 src/TimingWin.cpp
gosu-0.9.0.pre1 src/TimingWin.cpp
gosu-0.8.7.2 src/TimingWin.cpp
gosu-0.8.7.1 src/TimingWin.cpp
gosu-0.8.7 src/TimingWin.cpp
gosu-0.8.6 src/TimingWin.cpp
gosu-0.8.6.pre1 src/TimingWin.cpp
gosu-0.8.5 src/TimingWin.cpp
gosu-0.8.5.pre1 src/TimingWin.cpp
gosu-0.8.4 src/TimingWin.cpp
gosu-0.8.3 src/TimingWin.cpp
gosu-0.8.2 src/TimingWin.cpp
gosu-0.8.1 src/TimingWin.cpp
gosu-0.8.0 src/TimingWin.cpp
gosu-0.8.0.pre7 src/TimingWin.cpp
gosu-0.8.0.pre6 src/TimingWin.cpp
gosu-0.8.0.pre5 src/TimingWin.cpp
gosu-0.8.0.pre4 src/TimingWin.cpp
gosu-0.8.0.pre3 GosuImpl/TimingWin.cpp