diff --git a/pysnooper/pycompat.py b/pysnooper/pycompat.py index c6b23b3..fedb3a5 100644 --- a/pysnooper/pycompat.py +++ b/pysnooper/pycompat.py @@ -90,6 +90,6 @@ else: return datetime_module.time(hour, minute, second, microsecond) -def timedelta_isoformat(timedelta): +def timedelta_isoformat(timedelta, timespec='microseconds'): time = (datetime_module.datetime.min + timedelta).time() - return time_isoformat(time) + return time_isoformat(time, timespec) diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py index e6a4a65..7a56d3b 100644 --- a/pysnooper/tracer.py +++ b/pysnooper/tracer.py @@ -374,7 +374,7 @@ class Tracer: start_time = self.start_times[frame] duration = datetime_module.datetime.now() - start_time now_string = pycompat.timedelta_isoformat( - duration) if not self.normalize else ' ' * 15 + duration, timespec='microseconds') if not self.normalize else ' ' * 15 else: now = datetime_module.datetime.now().time() now_string = pycompat.time_isoformat(now, timespec='microseconds') if not self.normalize else ' ' * 15