Path: utzoo!attcan!uunet!husc6!rutgers!ucsd!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: A few questions about Ticks Message-ID: <25509@ucbvax.BERKELEY.EDU> Date: 7 Aug 88 01:27:35 GMT References: <3417@polya.Stanford.EDU> <460@poseidon.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 35 In article <460@poseidon.UUCP> ech@poseidon.UUCP (Edward C Horvath) writes: >> 2) Why use the TickCount() trap when the Global variable Ticks is available? >But it's just a copy of a real timer elsewhere. Under A/UX, or any future Mac >OS that memory-maps the low-memory globals, the TickCount trap can be >supported by checking the hardware clock; but keeping the Ticks global >up-to-date is fairly wastful. This is a misunderstanding of what is really going on. The Mac _does_ have a hardware timer, but it is implemented using a fairly slow LSI chip, so it is rarely used. On system start-up, the Mac copies time information from the real timer into the global variable Time. From then on, in normal operation, both Time and Ticks are update by an ordinary VBL task, not by the hardware timer. As has been discussed earlier, if the system is busy, it is allowed to skip executing VBL tasks. As a result, the variables Ticks and Time drift. My Menu Clock (shareware $5.00) resynchronizes to the hardware timer once every five minutes or so. The drift is negligable over that period, and the extra CPU it costs to update the clock variables form the slow hardware is also negligable, though I wouldn't want to try doing it 60 times a second. The TickCount() system call usually just returns the value of Ticks. If you have "profiling" on, (See I. M. Vol 1 (the Event Manager) for more deatils about this use of the word profiling.) then a Guided Tour or a macro can slow down or speed up the passing of time, from the point of view of an application program. An interesting bug in most versions of the imagewriter driver is that it assumes that registers A0, and A1 will be preserved across a call to TickCount(), which isn't true if profiling is on. --- David Phillip Oster --When you asked me to live in sin with you Arpa: oster@dewey.soe.berkeley.edu --I didn't know you meant sloth. Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu