Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/explorepy/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def __init__(self):
self.opcode = OpcodeID.CMD_SET_EMMC_TIME
from datetime import datetime
now = datetime.now()
if not (2020 < now.year < 2099):
raise ValueError(f"Unsupported year: {now.year}")
date_time = bytes(
[
now.year - 2000,
Expand Down
12 changes: 8 additions & 4 deletions src/explorepy/explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,14 @@ def set_binary_time(self):
Returns:
bool: True for success, False otherwise
"""
cmd = SetBinaryTime()
if self.stream_processor.configure_device(cmd):
logger.info('Device set to current time.')
return True
try:
cmd = SetBinaryTime()
if self.stream_processor.configure_device(cmd):
logger.info('Device set to current time.')
return True
except ValueError as e:
logger.error('Error on setting the binary file time: {}'.format(e))
return False

def reset_soft(self):
"""Reset the device to the default settings
Expand Down
Loading