File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -234,6 +234,8 @@ def __init__(self):
234234 self .opcode = OpcodeID .CMD_SET_EMMC_TIME
235235 from datetime import datetime
236236 now = datetime .now ()
237+ if not (2020 < now .year < 2099 ):
238+ raise ValueError (f"Unsupported year: { now .year } " )
237239 date_time = bytes (
238240 [
239241 now .year - 2000 ,
Original file line number Diff line number Diff line change @@ -661,10 +661,14 @@ def set_binary_time(self):
661661 Returns:
662662 bool: True for success, False otherwise
663663 """
664- cmd = SetBinaryTime ()
665- if self .stream_processor .configure_device (cmd ):
666- logger .info ('Device set to current time.' )
667- return True
664+ try :
665+ cmd = SetBinaryTime ()
666+ if self .stream_processor .configure_device (cmd ):
667+ logger .info ('Device set to current time.' )
668+ return True
669+ except ValueError as e :
670+ logger .error ('Error on setting the binary file time: {}' .format (e ))
671+ return False
668672
669673 def reset_soft (self ):
670674 """Reset the device to the default settings
You can’t perform that action at this time.
0 commit comments