diff --git a/mydefs.py b/mydefs.py index 68f3709..e122e32 100644 --- a/mydefs.py +++ b/mydefs.py @@ -155,6 +155,15 @@ def ping(hostname): # Русифицированный вывод timedelta class RuTimedelta(timedelta): + def __new__(cls, tm): + if isinstance(tm, timedelta): + return timedelta.__new__( + cls, + days=tm.days, + seconds=tm.seconds, + microseconds=tm.microseconds + ) + def __str__(self): hours, remainder = divmod(self.seconds, 3600) minutes, seconds = divmod(remainder, 60)