Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 2 - Event Manager / Event Manager Reference
Event Manager Routines / Getting Timing Information


TickCount

You can use the TickCount function to get the current number of ticks (a tick is approximately 1/60 of a second) since the system last started up.

FUNCTION TickCount: LongInt;
DESCRIPTION
The TickCount function returns a long integer that indicates the current number of ticks since the system last started up. You can use this value to compare the number of ticks that have elapsed since a given event or other action occurred. For example, you could compare the current value returned by TickCount with the value of the when field of an event record.

The tick count is incremented during the vertical retrace interrupt, but this interrupt can be disabled. Your application should not rely on the tick count to increment with absolute precision. Your application also should not assume that the tick count always increments by 1; an interrupt task might keep control for more than one tick. If your application keeps track of the previous tick count and then compares this value with the current tick count, your application should compare the two values by checking for a "greater than or equal" condition rather than "equal to previous tick count plus 1."

WARNING
Don't rely on the tick count being exact; it's usually accurate to within one tick, but this level of accuracy is not guaranteed.
ASSEMBLY-LANGUAGE NOTE
The value returned by TickCount is also accessible in the global variable Ticks.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996