[hatari-devel] Time overflow patch |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
Hatari will run for 292266 years (including leap seconds),
then stall for 292266 years; repeatedly.
This patch allows Hatari to run continuously.
Sincerely,
David
--- hatari/src/main.c 2013-11-01 06:14:57.000000000 -0700
+++ hatari/src/main.c 2013-11-01 13:35:49.000000000 -0700
@@ -276,7 +276,7 @@
void Main_WaitOnVbl(void)
{
Sint64 CurrentTicks;
- static Sint64 DestTicks = 0;
+ static Sint64 DestTicks = -1;
Sint64 FrameDuration_micro;
Sint64 nDelay;
@@ -292,10 +292,10 @@
FrameDuration_micro = ClocksTimings_GetVBLDuration_micro ( ConfigureParams.System.nMachineType , nScreenRefreshRate );
CurrentTicks = Time_GetTicks();
- if ( DestTicks == 0 ) /* first call, init DestTicks */
+ if ( DestTicks < 0 ) /* on first call or overflow, init DestTicks */
DestTicks = CurrentTicks + FrameDuration_micro;
- DestTicks += pulse_swallowing_count; /* audio.c - Audio_CallBack() */
+ DestTicks += pulse_swallowing_count; /* audio.c - Audio_CallBack() */
nDelay = DestTicks - CurrentTicks;