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: Processes
Chapter 3 - Time Manager / About the Time Manager


The Revised Time Manager

System software version 6.0.3 introduced a revised version of the Time Manager. This version provides better time resolution and more accurate measurements of elapsed time. You can represent time delays in the revised Time Manager as microseconds (\xB5sec) as well as milliseconds (msec), with a finest resolution of 20 microseconds. The external programming interface did not change from the original to the revised Time Manager, although the revised version provides a means to distinguish microsecond delays from millisecond delays.

The revised Time Manager interprets negative time values (which were not formerly allowed) as negated microseconds. For example, a value of -50 is interpreted as a delay of 50 microseconds. Positive time values continue to represent milliseconds. When specified as microseconds, the maximum delay is about 35 minutes. When specified as milliseconds, the maximum delay is about 1 day. (This differs from the maximum delay in the original Time Manager because of the finer resolution of the revised Time Manager.) When passed to PrimeTime, the time value is converted to an internal form. For this reason, it makes no difference which unit you use if the delay falls within the ranges of both.

The revised Time Manager provides additional features. The principal change concerns the tmCount field of the Time Manager task record (previously reserved for use by Apple Computer, Inc.). When you remove an active task from the revised Time Manager's queue, any time remaining until the scheduled execution time is returned in the tmCount field. This change allows you to use the Time Manager to compute elapsed times (as explained in the section "Computing Elapsed Time" on page 3-14). In addition, the high-order bit of the qType field of the task record is used as a flag to indicate whether the task timer is active. The InsTime procedure initially clears this bit, and PrimeTime sets it. This bit is cleared when the time expires or when your application calls RmvTime.

Although the revised Time Manager supports the specification of delay times in microseconds, you should use this feature primarily for the more accurate measurement of elapsed times. You should avoid specifying very small delay times as a way to execute a routine repeatedly at frequent intervals because this technique may use a considerable amount of processor time. The amount of processor time consumed by such timing services varies, depending largely on the performance of the CPU. With low-performance CPUs, little or no time may be left for other processing on the system (for instance, moving the mouse or running the application).


Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUN 1996