joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.77k stars 381 forks source link

Emulator real time clock stopped when menu dialog box is open #2082

Closed MX9000 closed 3 years ago

MX9000 commented 3 years ago

Describe the bug When I typed the DOS command TIME after opening a dialog box for a few minutes (e.g. "Configuration Tool" or "About DOSBox-X"), I noticed that the emulator's internal clock lagged behind the host clock, as if it stopped while the dialog box was open. I tried again the TIME command after a few minutes, but the emulator's clock never regained the lost time. To synchronize the emulator's clock with host PC clock I have to reset the virtual machine. Thank you.

To Reproduce

  1. Leave a dialog box open for some time.
  2. Close the dialog box
  3. Type TIME command at DOS prompt
  4. Compare emulator time with host computer time

Expected behavior I think that the emulator clock and the host computer clock should always be synchronized.

Environment (please complete the following information):

Wengier commented 3 years ago

@MX9000 Thanks for reporting this! You don't need to reset the virtual machine to synchronize the internal clock with host PC clock though. Just type TIME /H should do the job. But I agree that there can be perhaps the default option to automatically synchronize the internal clock with the host PC clock.

Wengier commented 3 years ago

I have now added the ability to automatically synchronize the date/time with the host system by default. It can be turned off by setting the new config option"synchronize time" to "false" in [dosbox] section, or if you manually change the date/time. Hope this helps.

MX9000 commented 3 years ago

@Wengier Thank you! I'll definitely try it in the next release.

joncampbell123 commented 3 years ago

@Wengier I had to adjust the BIOS_TIMER synchronize code due to some conflicts with demoscene stuff that relies on BIOS_TIMER while setting a higher tick rate, and I had to make "synchronize time" false by default.

The fix retains BIOS_TIMER synchronization with local time, but only if the timer is at the proper 18.2Hz rate. The fix temporarily skips synchronization if anything still uses the BIOS IRQ0 handler but at a faster tick rate (like the aformentioned demoscene stuff).

Wengier commented 3 years ago

@MX9000 Due to the fact that time synchronization does not yet work in all situations (PC-98, higher tick rate mode, etc), the feature will be disabled by default as mentioned above, but if desired you can always enable it either from the config file or from the “DOS” menu. Hope this helps.

MX9000 commented 3 years ago

@joncampbell123 , @Wengier Thank you very much for your efforts and Merry Christmas!

MX9000 commented 3 years ago

Issue solved. Thanks.