Parcourir la source

add(Timer): remain method

Azure il y a 1 an
Parent
commit
265200d8c4
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      module/base/timer.py

+ 7 - 0
module/base/timer.py

@@ -159,6 +159,13 @@ class Timer:
         from module.logger import logger
         logger.info(str(self))
 
+    def remain(self):
+        """
+        remain time
+        :return:
+        """
+        return self._current + self.limit - time.time()
+
     def __str__(self):
         return f'Timer(limit={round(self.current(), 3)}/{self.limit}, count={self._reach_count}/{self.count})'