dgs.utils.timer.DifferenceTimer.add

DifferenceTimer.add(prev_time: float, now: float | None = None) float[source]

Append the difference between a previous time and the current time to this timer.

Parameters:
  • prev_time – The previous time in seconds. The value is used to compute the time difference in seconds to now.

  • now – The current time in seconds. If not provided, the current time is used. Can be used to make sure, that the time difference is computed relative to a specific time when computing multiple values.

Returns:

The difference between now and the previous value in seconds.

Return type:

diff