dgs.utils.timer.DifferenceTimers.add

DifferenceTimers.add(name: str, prev_time: float, now: float | None = None) float[source]

Add a new time difference to the timer with the given name. Creates a new timer if it does not exist yet.

Parameters:
  • name – The name of the timer.

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

  • now – The current time in seconds.

Returns:

The difference between now and the previous value in seconds.