vcorelib.math.time
index
/home/vkottler/src/vkottler/workspace/vcorelib/vcorelib/math/time.py

Math utilities involving units of time and other conversions.

 
Classes
       
builtins.object
Timer

 
class Timer(builtins.object)
    Timer() -> None
 
A class for measuring and logging how long events take.
 
  Methods defined here:
__init__(self) -> None
Initialize this timer.
log(self, log: Union[logging.Logger, logging.LoggerAdapter[Any]], message: str, *args, level: int = 20, reminder: bool = False, **kwargs) -> Iterator[NoneType]
Log how long the caller's context took to execute.
measure_ns(self) -> Iterator[int]
Compute the time that the caller's context takes, provides an integer
token that can be used to query for the result afterwards.
result(self, token: int) -> int
Get the timer result.

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
Functions
       
byte_count_str(byte_count: int) -> str
Get a string representing a number of bytes.
default_time_ns() -> int
Get a timestamp value using a default method.
nano_str(nanos: int, is_time: bool = False, max_prefix: int = 3, unit: vcorelib.math.unit.UnitSystem = UnitSystem(prefixes=['n', 'u', 'm', '', 'k', 'M', 'G', 'T'], divisor=1000), prefix_space: bool = False, iteration: int = 0) -> str
Convert an arbitrary value in a 10^-9 domain into as concise of a string
as possible.
rate_str(period_s: float) -> str
Get a string representing a rate in Hz.
seconds_str(seconds: int) -> Tuple[str, int]
Attempt to characterize a large amount of seconds into a string describing
hours and minutes, returning the string (may be empty) and the seconds
left over.

 
Data
        LoggerType = typing.Union[logging.Logger, logging.LoggerAdapter[typing.Any]]
TIMER = <vcorelib.math.time.Timer object>