From 3787d094eca80682501904a0d7dc291b8e98b913 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 2 May 2018 21:26:39 -0400 Subject: [PATCH] Deals with potential precision pitfall. --- Storage/Disk/Drive.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Storage/Disk/Drive.cpp b/Storage/Disk/Drive.cpp index 5ef0dac5f..f1de0609c 100644 --- a/Storage/Disk/Drive.cpp +++ b/Storage/Disk/Drive.cpp @@ -205,9 +205,14 @@ void Drive::setup_track() { assert(track_time_now >= Time(0) && current_event_.length <= Time(1)); Time time_found = track_->seek_to(track_time_now); - assert(time_found >= Time(0) && time_found < Time(1) && time_found <= track_time_now); - offset = track_time_now - time_found; + // time_found can be greater than track_time_now if limited precision caused rounding + if(time_found <= track_time_now) { + offset = track_time_now - time_found; + } else { + offset.set_zero(); + } + get_next_event(offset); }