[AD] Timer problems on 4.3.10

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi all.

I just had a user report a problem that rest() wasn't working and when I
looked into it, surely enough it was broken.  The odd thing is that when I
looked at my timer implementation it doesn't make much sense.  Fair enough,
I remember I wrote that when I was new to Allegro.

So I started to dig deeper and found that when requesting a timer using
install_int(), it uses a magic formula to convert the millisecond wait to
timer ticks:

#define MSEC_TO_TIMER(x)      ((long)(x) * (TIMERS_PER_SECOND / 1000))

Where TIMERS_PER_SECOND is 1193181L.

What precisely is this?  Is is an old PC clock time that all Allegro timing
is based on?  When I call timer.c:_handle_timer_tick() starts calculating
the delay to the next time with a variable that is set to 0x8000.  I can't
see how this 0x8000 fits into a timer that has a frequency of 1193181L
times per second.

I'm rather confused here - could someone shed some light?

-- 
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2    ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne      ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/