timer

Report elapsed time between two events

Description

timer resets the time elapsed since the object was started to zero and starts keeping time when a bang is sent to the left inlet. The elapsed time output each time a bang is sent to the right inlet can be set for milliseconds, or ticks (one of the Max time format options).

Arguments

None.

Messages

bang In left inlet: Starts - or restarts - the timer.

In right inlet: Sends out the time elapsed since the timer was started.
clock setclock object name [symbol]
The word clock, followed by the name of an existing setclock object, sets the timer object to be controlled by that setclock object rather than by Max’s internal millisecond clock. The word clock by itself sets the timer object back to using Max’s regular millisecond clock.

Attributes

Name Type g/s Description
format symbol Set the time format to use for output (defult = milliseconds). By default, the output is in milliseconds. Output may also be specified in ticks (one of the Max time format options).
transport symbol The name of a transport object with which to associate. By default, the global transport is used. This is used in the output format conversion.

Information for box attributes common to all objects

Output

float: When a bang is received in the right inlet, the time elapsed -- in milliseconds -- since the timer was started, is sent out the outlet.

Examples

Report time between bang messages... A single event can report time then restart timer

See Also

Name Description
clocker Report elapsed time, at regular intervals
cpuclock Precise "real-world" time measurements
delay Delay a bang before passing it on.
setclock Control the clock speed of timing objects remotely
transport Control a master clock and report time values.
Max Basic Tutorial 19: Timing Max Basic Tutorial 19: Timing