mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-14 13:33:42 +00:00
Upped the assert quotient.
This commit is contained in:
parent
73080d6c36
commit
c196f0018f
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "DiskController.hpp"
|
#include "DiskController.hpp"
|
||||||
#include "../../NumberTheory/Factors.hpp"
|
#include "../../NumberTheory/Factors.hpp"
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
using namespace Storage::Disk;
|
using namespace Storage::Disk;
|
||||||
|
|
||||||
@ -32,8 +33,10 @@ void Controller::setup_track() {
|
|||||||
|
|
||||||
Time offset;
|
Time offset;
|
||||||
Time track_time_now = get_time_into_track();
|
Time track_time_now = get_time_into_track();
|
||||||
|
assert(track_time_now >= Time(0) && current_event_.length <= Time(1));
|
||||||
if(track_) {
|
if(track_) {
|
||||||
Time time_found = track_->seek_to(track_time_now);
|
Time time_found = track_->seek_to(track_time_now);
|
||||||
|
assert(time_found >= Time(0) && time_found <= track_time_now);
|
||||||
offset = track_time_now - time_found;
|
offset = track_time_now - time_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +96,9 @@ void Controller::get_next_event(const Time &duration_already_passed) {
|
|||||||
|
|
||||||
// divide interval, which is in terms of a single rotation of the disk, by rotation speed to
|
// divide interval, which is in terms of a single rotation of the disk, by rotation speed to
|
||||||
// convert it into revolutions per second; this is achieved by multiplying by rotational_multiplier_
|
// convert it into revolutions per second; this is achieved by multiplying by rotational_multiplier_
|
||||||
set_next_event_time_interval((current_event_.length - duration_already_passed) * rotational_multiplier_);
|
assert(current_event_.length <= Time(1) && current_event_.length >= Time(0));
|
||||||
|
Time interval = (current_event_.length - duration_already_passed) * rotational_multiplier_;
|
||||||
|
set_next_event_time_interval(interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::process_next_event()
|
void Controller::process_next_event()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user