openMSX
|
Represents a clock with a fixed frequency. More...
#include <Clock.hh>
Public Member Functions | |
constexpr | Clock (EmuTime::param e) |
Create a new clock, which starts ticking at the given time. | |
constexpr EmuTime::param | getTime () const |
Gets the time at which the last clock tick occurred. | |
constexpr bool | before (EmuTime::param e) const |
Checks whether this clock's last tick is or is not before the given time stamp. | |
constexpr unsigned | getTicksTill (EmuTime::param e) const |
Calculate the number of ticks for this clock until the given time. | |
constexpr unsigned | getTicksTill_fast (EmuTime::param e) const |
Same as above, only faster, Though the time interval may not be too large. | |
constexpr uint64_t | getTicksTillUp (EmuTime::param e) const |
Calculate the number of ticks this clock has to tick to reach or go past the given time. | |
constexpr EmuTime | operator+ (uint64_t n) const |
Calculate the time at which this clock will have ticked the given number of times (counted from its last tick). | |
constexpr EmuTime | getFastAdd (unsigned n) const |
Like operator+() but faster, though the step can't be too big (max a little over 1 second). | |
constexpr void | reset (EmuTime::param e) |
Reset the clock to start ticking at the given time. | |
constexpr void | advance (EmuTime::param e) |
Advance this clock in time until the last tick which is not past the given time. | |
constexpr void | advance_fast (EmuTime::param e) |
Same as above, only faster, Though the time interval may not be too large. | |
constexpr void | operator+= (unsigned n) |
Advance this clock by the given number of ticks. | |
constexpr void | fastAdd (unsigned n) |
Advance this clock by the given number of ticks. | |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned) |
Static Public Member Functions | |
static constexpr EmuDuration | duration (unsigned ticks) |
Calculates the duration of the given number of ticks at this clock's frequency. | |
Represents a clock with a fixed frequency.
The frequency is in Hertz, so every tick is 1/frequency second. A clock has a current time, which can be increased by an integer number of ticks.
|
inlineexplicitconstexpr |
|
inlineconstexpr |
Advance this clock in time until the last tick which is not past the given time.
It is not allowed to advance a clock to a time in the past.
Definition at line 111 of file Clock.hh.
Referenced by openmsx::Y8950Adpcm::sync(), openmsx::MSXE6Timer::writeIO(), openmsx::MSXHiResTimer::writeIO(), and openmsx::MSXTurboRPCM::writeIO().
|
inlineconstexpr |
Same as above, only faster, Though the time interval may not be too large.
Definition at line 118 of file Clock.hh.
References DivModByConst< DIVISOR >::mod().
|
inlineconstexpr |
|
inlinestaticconstexpr |
|
inlineconstexpr |
Advance this clock by the given number of ticks.
This method is similar to operator+=, but it's optimized for speed. OTOH the amount of ticks should not be too large, otherwise an overflow occurs. Use operator+() when the duration of the ticks approaches 1 second.
|
inlineconstexpr |
Like operator+() but faster, though the step can't be too big (max a little over 1 second).
Definition at line 94 of file Clock.hh.
Referenced by openmsx::VDPAccessSlots::Calculator::getTime(), and openmsx::MSXTurboRPCM::writeIO().
|
inlineconstexpr |
Calculate the number of ticks for this clock until the given time.
It is not allowed to call this method for a time in the past.
Definition at line 58 of file Clock.hh.
Referenced by openmsx::MSXE6Timer::peekIO(), openmsx::MSXHiResTimer::peekIO(), openmsx::MSXTurboRPCM::peekIO(), openmsx::PioneerLDControl::peekMem(), openmsx::MSXHiResTimer::readIO(), openmsx::Y8950Adpcm::sync(), and openmsx::NowindInterface::writeMem().
|
inlineconstexpr |
Same as above, only faster, Though the time interval may not be too large.
Definition at line 70 of file Clock.hh.
References DivModByConst< DIVISOR >::div().
Referenced by openmsx::VDPAccessSlots::Calculator::Calculator(), openmsx::SpriteChecker::checkUntil(), openmsx::VDPAccessSlots::getAccessSlot(), openmsx::VDP::getTicksThisFrame(), openmsx::V9990::getUCTicksThisFrame(), openmsx::R800TYPE::R800Refresh(), openmsx::R800TYPE::R800RefreshSlow(), and openmsx::SpriteChecker::updateDisplayMode().
|
inlineconstexpr |
|
inlineconstexpr |
Gets the time at which the last clock tick occurred.
Definition at line 46 of file Clock.hh.
Referenced by openmsx::VDP::getFrameStartTime(), openmsx::VDP::isInsideFrame(), openmsx::VDPIODelay::readIO(), openmsx::TC8566AF::serialize(), openmsx::WD2793::serialize(), openmsx::Mouse::serialize(), openmsx::SCC::serialize(), openmsx::VDPCmdEngine::serialize(), openmsx::VDPIODelay::writeIO(), openmsx::MSXMatsushita::writeIO(), and openmsx::MSXTurboRPCM::writeIO().
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Reset the clock to start ticking at the given time.
Definition at line 103 of file Clock.hh.
Referenced by openmsx::SpriteChecker::frameStart(), openmsx::Y8950Adpcm::reset(), openmsx::MSXE6Timer::reset(), openmsx::MSXHiResTimer::reset(), openmsx::MSXTurboRPCM::reset(), openmsx::Y8950Adpcm::serialize(), openmsx::SpriteChecker::serialize(), and openmsx::R800TYPE::setTime().
|
inline |