Пример #1
0
 def test_time_duration_diff(self) -> None:
     """TODO: Doku."""
     date1 = datetime.now()
     date2 = date1 + timedelta(0, 5)
     self.assertEqual(time_duration_diff(date1, date2), "5 seconds")
     date1 = datetime.now()
     date2 = datetime.now()
     self.assertEqual(time_duration_diff(date1, date2), "1 second")
Пример #2
0
 def get_last_accept_time(self):
     """
     the function retrieves the modify time of the acceptance file
     and compares the time to the current time
     """
     timestamp = self.cfg_easywall.get_value("ACCEPTANCE", "timestamp")
     if timestamp == "":
         return "never"
     timestamp = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S.%f')
     now = datetime.now()
     return time_duration_diff(timestamp, now)