From ecebb1df780ed3b03abd5b3578b10c3dd9ed0287 Mon Sep 17 00:00:00 2001 From: dcox <156420435+dcox761@users.noreply.github.com> Date: Sat, 13 Jul 2024 16:35:13 +0930 Subject: [PATCH] Set epoch to 1/1/2000 on error Handle error on newly flashed ESP32 where time has not been synchronised --- rshell/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rshell/main.py b/rshell/main.py index 40071f5..96e5476 100755 --- a/rshell/main.py +++ b/rshell/main.py @@ -1564,7 +1564,10 @@ def __init__(self, pyb): print('----') self.dev_name_short = self.name QUIET or print('Retrieving time epoch ... ', end='', flush=True) - epoch_tuple = self.remote_eval(get_time_epoch) + try: + epoch_tuple = self.remote_eval(get_time_epoch) + except Exception: + epoch_tuple = (2000, 1, 1, 0, 0, 0, 0, 1, -1) if len(epoch_tuple) == 8: epoch_tuple = epoch_tuple + (0,) QUIET or print(time.strftime('%b %d, %Y', epoch_tuple))