use total_seconds() when calculating search change diff

as tested like:

    $ python -c "from datetime import datetime; import time; a = datetime.now(); time.sleep(0.5); b = datetime.now(); print((b-a).seconds)"
    0
    $ python -c "from datetime import datetime; import time; a = datetime.now(); time.sleep(0.5); b = datetime.now(); print((b-a).total_seconds())"
    0.50064
This commit is contained in:
sentriz
2020-04-20 20:57:37 +01:00
parent e3d6e9ea8f
commit 8b1a6d6892
2 changed files with 2 additions and 2 deletions

View File

@@ -283,7 +283,7 @@ class MainWindow(Gtk.ApplicationWindow):
def _on_search_entry_changed(self, entry: Gtk.Entry):
now = datetime.now()
if (now - self.last_search_change_time).seconds < 0.5:
if (now - self.last_search_change_time).total_seconds() < 0.5:
while len(self.searches) > 0:
search = self.searches.pop()
if search: