From 48cc9d94cdb102064fb6b3248c1d2b8f288cb96f Mon Sep 17 00:00:00 2001 From: iory Date: Sat, 18 Apr 2020 23:37:03 +0900 Subject: [PATCH] Fixed timedelta_isoformat --- pysnooper/pycompat.py | 4 ++-- pysnooper/tracer.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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