We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f93279 commit 72ec45fCopy full SHA for 72ec45f
drivers/driver_wifi.py
@@ -3,6 +3,7 @@
3
from socketpool import SocketPool
4
from ssl import create_default_context
5
from adafruit_requests import Session
6
+from cptoml import fetch
7
8
9
class driver_wifi:
@@ -299,20 +300,10 @@ def timeset(self, tz=None) -> bool:
299
300
from time import struct_time
301
302
if tz is None:
- if self.connected:
303
- try:
304
- utc_offset = self.get("https://worldtimeapi.org/api/ip").json()[
305
- "utc_offset"
306
- ]
307
- negative = utc_offset[0] != "+"
308
- tz = int(utc_offset[1:3])
309
- if negative:
310
- tz = -tz
311
- self.reset_session()
312
- except:
313
- return False
314
- else:
315
+ tz = fetch("tz_offset")
+
+ if tz is None:
+ tz = 2
316
317
if tz != self._tz:
318
self._tz = tz
0 commit comments