Bläddra i källkod

add(Timer): remain method

Azure 1 år sedan
förälder
incheckning
265200d8c4
1 ändrade filer med 7 tillägg och 0 borttagningar
  1. 7 0
      module/base/timer.py

+ 7 - 0
module/base/timer.py

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