Class WallClockTime

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    ButtonTime

    public class WallClockTime
    extends Source
    Upon firing, this actor outputs the elapsed real time in seconds since the start time of the model, as reported by the director. The output type is double. The resolution of time depends on the implementation of the Java virtual machine, but with Sun's JDK 1.3 under Windows 2000, it is 10 milliseconds.

    Note that relying on the data produced by this actor is tricky in domains where you do not have precise control over the scheduling, since the output reflects the wall-clock time at which this actor is fired, which may or may not be indicative of the times at which other actors fire. So that you can get more control over the schedule, the input provided at the trigger port is passed through to the passThrough output port. This can be used to ensure that this actor fires before another downstream actor.

    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    Director.elapsedTimeSinceStart()
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (eal)
    • Field Detail

      • passThrough

        public TypedIOPort passThrough
        The output port to which the trigger input is passed. The type is the same as the type of the trigger port, which is undeclared, meaning that it will resolve to any type.
    • Method Detail

      • _getCurrentTime

        protected double _getCurrentTime()
        Get the elapsed time since the model starts.
        Returns:
        A double value representing the elapsed time.