Sha256: bd1ef6617c9aa3e2ffac0f88e2411d9ad7f6fa066930b8f97eed200444073d64

Contents?: true

Size: 467 Bytes

Versions: 7

Compression:

Stored size: 467 Bytes

Contents

#include <Gosu/Timing.hpp>
#include <unistd.h>
#include <sys/time.h>

void Gosu::sleep(unsigned milliseconds)
{
	usleep(milliseconds * 1000);
}

unsigned long Gosu::milliseconds()
{
    timeval tp;
    gettimeofday(&tp, NULL);
    // 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 (tp.tv_usec / 1000UL + tp.tv_sec * 1000UL) & 0x1fffffff;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gosu-0.7.43 GosuImpl/TimingUnix.cpp
gosu-0.7.41 GosuImpl/TimingUnix.cpp
gosu-0.7.40 GosuImpl/TimingUnix.cpp
gosu-0.7.39 GosuImpl/TimingUnix.cpp
gosu-0.7.38 GosuImpl/TimingUnix.cpp
gosu-0.7.37 GosuImpl/TimingUnix.cpp
gosu-0.7.36.2 GosuImpl/TimingUnix.cpp