Timer

class Timer(start_time: Time, duration: TimeInterval)

Bases: object

Timer object.

Attributes

start_timeTime

Start time after which the timer is active.

durationTimeInterval

Time duration of the timer, starting from start_time.

Methods

is_active()

It checks if the simulation current_time is greater than or equal to start_time but lower than or equal to the sum of current_time and duration.

property duration: TimeInterval

Time duration of the timer, starting from start_time.

Returns

TimeInterval

Time duration of the timer, starting from start_time.

Raises

TypeError

If duration is not an instance of TimeInterval.

is_active(current_time: Time) bool

It checks if the simulation current_time is greater than or equal to start_time but lower than or equal to the sum of current_time and duration.

Parameters

current_timeTime

Current time of the simulation, to be compared with start_time and duration.

Returns

bool

Whether current_time is greater than or equal to start_time but lower than or equal to the sum of start_time and duration.

Raises

TypeError

If current_time is not an instance of Time.

property start_time: Time

Start time after which the timer is active.

Returns

Time

Start time after which the timer is active.

Raises

TypeError

If start_time is not an instance of Time.