Sim::Clock - Simulation clock used by the dispatcher
This document describes Sim::Clock 0.03 released on 2 June, 2007.
use Sim::Clock; my $clock = Sim::Clock->new(0); $clock->push_to(5.6); print $clock->now; # 5.6 $clock->push_to(3); # exception! $clock->reset();
This class offers a simulation clock for Sim::Dispatcher. Basically you needn't create your own clock at all since Sim::Dispatcher always creates one internally and you seldom or never need more than one clock in your simulator. But you really feel the need to do something fancy, simulating quantum mechanics for example, here is the rope.
$obj->new( $init_time ? )
Ths is the constructor for Sim::Clock objects. The $init_time argument specifies the initial time read of the clock and can be omitted.
Sim::Clock
$init_time
$obj->now()
Reads the current time from the clock.
$obj->push_to($time)
Push the clock to the specified timestamp $time, which can't be earlier than the value obtained by the now method.
$time
now
$obj->reset()
Resets the clock to time 0.
Agent Zhang <agentzh@gmail.com>
Copyright 2006 by Agent Zhang. All rights reserved.
This library is free software; you can modify and/or modify it under the same terms as Perl itself.
Sim::Dispatcher, Sim.
To install Sim, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sim
CPAN shell
perl -MCPAN -e shell install Sim
For more information on module installation, please visit the detailed CPAN module installation guide.