IBM / alchemy-logging

Application logging libraries with consistent semantics across c++, python, typescript, and go
MIT License
12 stars 11 forks source link

Replace usage of time.time() with time.monotonic() for duration calcu… #457

Closed mynhardtburger closed 1 month ago

mynhardtburger commented 1 month ago

Description

Replace usage of time.time() with time.monotonic() for duration calculations.

time.monotonic() is not affected by system clock updates (eg. due to NTP or daylight savings adjustments) resulting in a more reliable duration calculation.

time.perf_counter() was not used since alog is not a performance benchmarking focussed library.

mynhardtburger commented 1 month ago

@gabe-l-hart A small PR to use the appropriate time for the ScopedTimer and ContextTimer.