-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emulator: don't rely on past values of Instant
Previously, I used a Instant keeping the theorical time that the gameboy was turned on to calculate the ammount of clocks in order to emulate the gameboy in real time. Every time I fast-forward the emulate I recomputed the start Instant to `Instant::now() - clock_to_duration(gb.clock_count)`, getting a value of Instant in the past. But it is not guarranteed that Instant is able to represent times in the past and may panic on underflow (See sebcrozet/instant#45). This is fixed by keeping `last_start_time: Instant` as the time that the gameboy started running at the clock count `last_start_clock`.
- Loading branch information
Showing
1 changed file
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters