From: George Foot Newsgroups: comp.os.msdos.djgpp Subject: Re: clock() function Date: 25 Jan 1998 07:47:06 GMT Organization: Oxford University, England Lines: 41 Message-ID: <6aeqlq$qjq$2@news.ox.ac.uk> References: <6ae2u5$ls2$1 AT herald DOT Mines DOT EDU> NNTP-Posting-Host: sable.ox.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On 25 Jan 1998 01:01:57 GMT in comp.os.msdos.djgpp Jean-Luc Romano wrote: : I have to mention that I am not familiar with the : initialise_timer() routine at all, so I do not know if that routine : has anything to do with what I am trying to accomplish. : Can anyone tell me if there is a better way of checking to see : if a certain amount of time has elapsed? I think that if you install_timer() (part of the Allegro library) it speeds up the system clock dramatically. Either don't do this (which will upset some other parts of Allegro) or use Allegro's timer routines for what you want to do. The simplest way to use Allegro's routines to do this is like so: volatile int global_ticks = 0; void my_timer_function () { global_ticks++; } END_OF_FUNCTION (my_timer_function); Then at initialisation: LOCK_VARIABLE (global_ticks); LOCK_FUNCTION (my_timer_function); install_timer(); install_int_ex (my_timer_function, BPS_TO_TIMER (1)); Look up timers in the Allegro help files for full information. The effect of the above is that global_ticks will be increased once (the `1') per second. You can read this variable in your main loop. -- george DOT foot AT merton DOT oxford DOT ac DOT uk