mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-01-23 02:14:04 +00:00
Refactor the timedelta_isoformat
This commit is contained in:
parent
35d3bc2db1
commit
444ea17314
2 changed files with 3 additions and 6 deletions
|
|
@ -90,9 +90,6 @@ else:
|
|||
return datetime_module.time(hour, minute, second, microsecond)
|
||||
|
||||
|
||||
def timedelta_isoformat(timedelta, timespec='microseconds'):
|
||||
assert isinstance(timedelta, datetime_module.timedelta)
|
||||
if timespec != 'microseconds':
|
||||
raise NotImplementedError
|
||||
def timedelta_isoformat(timedelta):
|
||||
time = (datetime_module.datetime.min + timedelta).time()
|
||||
return time_isoformat(time, timespec)
|
||||
return time_isoformat(time)
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ class Tracer:
|
|||
if self.elapsed_time:
|
||||
duration = datetime_module.datetime.now() - self.start_times[-1]
|
||||
now_string = pycompat.timedelta_isoformat(
|
||||
duration, timespec='microseconds') if not self.normalize else ' ' * 15
|
||||
duration) 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue