Time

This submodule provide a class to easily manipulate time.

class biom3d.utils.time.Time(name: str | None = None)[source]

Simple utility class to measure elapsed time across multiple events.

Useful for timing loops, function calls, or sections of code with optional naming and usage tracking (via a counter).

Variables:
  • name (str) – Name of the timer instance.

  • start_time (float) – Timestamp when the timer was last reset.

  • count (int) – Number of times .get() or __str__() has been called.

__init__(name: str | None = None)[source]

Initialize time.

Parameters:

name (str, optional) – Optional name identifier for the timer (used in __str__ debug output).

get() float[source]

Get the elapsed time in seconds since the last reset.

Increments the internal call counter.

Returns:

Elapsed time in seconds.

Return type:

float

reset() None[source]

Reset the timer and the internal call counter.

This will set the start time to the current time and reset the count to 0.