From a4ea59b83b01b6c1d60be3cb3ec31de47e7ec245 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sun, 26 Apr 2015 20:58:20 +0200 Subject: [PATCH] Two fixes: 1) The CC modified date is UTC not local time. 2) Thread switching can trigger 10ms accept timeout. Make it longer. --- src/calibre/devices/smart_device_app/driver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 1fb84f1eab..83438e5270 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -125,12 +125,12 @@ class ConnectionListener(Thread): getattr(self.driver, 'listen_socket', None) is not None: ans = select.select((self.driver.listen_socket,), (), (), 0) if len(ans[0]) > 0: - # timeout in 10 ms to detect rare case where the socket goes + # timeout in 100 ms to detect rare case where the socket goes # away between the select and the accept try: self.driver._debug('attempt to open device socket') device_socket = None - self.driver.listen_socket.settimeout(0.010) + self.driver.listen_socket.settimeout(0.100) device_socket, ign = eintr_retry_call( self.driver.listen_socket.accept) set_socket_inherit(device_socket, False) @@ -1595,7 +1595,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): 'for details')) return (None, True) - cc_mtime = parse_date(book.get('_format_mtime_'), as_utc=False) + cc_mtime = parse_date(book.get('_format_mtime_'), as_utc=True) self._debug(book.title, 'cal_mtime', calibre_mtime, 'cc_mtime', cc_mtime) if cc_mtime < calibre_mtime: book.set('_format_mtime_', isoformat(self.now))