diff options
author | VG <vg@devys.org> | 2016-05-12 17:37:54 +0200 |
---|---|---|
committer | VG <vg@devys.org> | 2016-05-12 17:37:54 +0200 |
commit | 94ce286d1fd5ae92aabe98b3f6f27d5426c703c9 (patch) | |
tree | afd32787b35b8f07522191e51806bd86c091ebf7 | |
parent | 06bcfc20cbeec905273e3975beddf7f509995a76 (diff) | |
download | climl-94ce286d1fd5ae92aabe98b3f6f27d5426c703c9.tar.gz climl-94ce286d1fd5ae92aabe98b3f6f27d5426c703c9.tar.bz2 climl-94ce286d1fd5ae92aabe98b3f6f27d5426c703c9.zip |
Change time.time to time.monotonic
This has less corner case and thus I could simplify function description by
deleting the corner case note.
-rw-r--r-- | climl/imap.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/climl/imap.py b/climl/imap.py index 30fa272..4616e01 100644 --- a/climl/imap.py +++ b/climl/imap.py @@ -90,19 +90,13 @@ def imap_waiter(connection): command and the begining of idle mode. If those events represent new mails, they will be checked at the idle timeout (it takes time to see them, but they are not lost). - - Note2: this function use time.time to check for timeout (in case the - server returns non-real-events like dovecot 2min keepalive messages), - this function can return (in case of system clock set) lower value - than a precendent call, but the only side effect will be a shorter - timeout which is not a deal breaker. ''' print('entering idle mode...') connection.idle() print('waiting for an event') try: - tenter = time.time() - while (time.time() - tenter) <= 24*60: + tenter = time.monotonic() + while (time.monotonic() - tenter) <= 24*60: events = connection.idle_check(timeout=24*60) if len(events) == 1 and \ str(bytes(events[0][0]), encoding='ascii') == 'OK': |