dgs.utils.timer.DifferenceTimer¶
- class dgs.utils.timer.DifferenceTimer[source]¶
A simple timer based on time differences, with a few helper functions.
Methods
- 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
- append(item)¶
S.append(value) – append value to the end of the sequence
- clear() None -- remove all items from S ¶
- copy()¶
- count(value) integer -- return number of occurrences of value ¶
- extend(other)¶
S.extend(iterable) – extend sequence by appending elements from the iterable
- index(value[, start[, stop]]) integer -- return first index of value. ¶
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- insert(i, item)¶
S.insert(index, value) – insert value before index
- pop([index]) item -- remove and return item at index (default last). ¶
Raise IndexError if list is empty or index is out of range.
- print(name: str, prepend: str, hms: bool = False) str [source]¶
Generate string for printing, containing average and total time.
- remove(item)¶
S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
- reverse()¶
S.reverse() – reverse IN PLACE
- sort(*args, **kwds)¶