openMSX
CPUClock.cc
Go to the documentation of this file.
1 #include "CPUClock.hh"
2 #include "serialize.hh"
3 
4 namespace openmsx {
5 
6 CPUClock::CPUClock(EmuTime::param time, Scheduler& scheduler_)
7  : clock(time)
8  , scheduler(scheduler_)
9  , remaining(-1), limit(-1), limitEnabled(false)
10 {
11 }
12 
13 void CPUClock::advanceTime(EmuTime::param time)
14 {
15  remaining = limit;
16  clock.advance(time);
17  setLimit(scheduler.getNext());
18 }
19 
20 template<typename Archive>
21 void CPUClock::serialize(Archive& ar, unsigned /*version*/)
22 {
23  sync();
24  ar.serialize("clock", clock);
25 }
27 
28 } // namespace openmsx
CPUClock(EmuTime::param time, Scheduler &scheduler)
Definition: CPUClock.cc:6
void advanceTime(EmuTime::param time)
Definition: CPUClock.cc:13
void advance(EmuTime::param e)
Advance this clock in time until the last tick which is not past the given time.
EmuTime::param getNext() const
TODO.
Definition: Scheduler.hh:54
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void setLimit(EmuTime::param time)
Definition: CPUClock.hh:92
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
void sync() const
Definition: CPUClock.hh:28
void serialize(Archive &ar, unsigned version)
Definition: CPUClock.cc:21