pymensago/keycard.py
def is_timestamp_valid(self) -> RetVal:
		'''Checks the validity of the timestamp. As a side effect, it checks the validity of the 
		expiration date field, but it does not check if the entry is actually expired'''
		m = re.match(r'^([0-9]{4})([0-9]{2})([0-9]{2})$', self.fields['Expires'])
		if not m or not _is_valid_date(int(m[2]), int(m[3]), int(m[1])):
			return RetVal(ErrBadData, 'bad expiration date')
		expire_time = datetime.datetime(int(m[1]), int(m[2]), int(m[3]),
			tzinfo=datetime.timezone(datetime.timedelta(hours=0)))

		m = re.match(r'^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$',
			self.fields['Timestamp'])
		if not m or not _is_valid_date(int(m[2]), int(m[3]), int(m[1]), 
			int(m[4]), int(m[5]), int(m[6])):
			return RetVal(ErrBadData, 'bad timestamp')
		timestamp_time = datetime.datetime(int(m[1]), int(m[2]), int(m[3]),
			int(m[4]), int(m[5]), int(m[6]),
			tzinfo=datetime.timezone(datetime.timedelta(hours=0)))

		if timestamp_time > expire_time:
			return RetVal(ErrBadData, 'bad timestamp')
		
		return RetVal()
Checks the validity of the timestamp. As a side effect, it checks the validity of the 
		expiration date field, but it does not check if the entry is actually expired
Checks the validity of the timestamp. As a side effect, it checks the validity of the
expiration date field, but it does not check if the entry is actually expired
Checks the validity of the timestamp . As a side effect it checks the validity of the expiration date field but it does not check if the entry is actually expired
def is_timestamp_valid(self) -> RetVal:
		m = re.match(r'^([0-9]{4})([0-9]{2})([0-9]{2})$', self.fields['Expires'])
		if not m or not _is_valid_date(int(m[2]), int(m[3]), int(m[1])):
			return RetVal(ErrBadData, 'bad expiration date')
		expire_time = datetime.datetime(int(m[1]), int(m[2]), int(m[3]),
			tzinfo=datetime.timezone(datetime.timedelta(hours=0)))
		m = re.match(r'^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$',
			self.fields['Timestamp'])
		if not m or not _is_valid_date(int(m[2]), int(m[3]), int(m[1]), 
			int(m[4]), int(m[5]), int(m[6])):
			return RetVal(ErrBadData, 'bad timestamp')
		timestamp_time = datetime.datetime(int(m[1]), int(m[2]), int(m[3]),
			int(m[4]), int(m[5]), int(m[6]),
			tzinfo=datetime.timezone(datetime.timedelta(hours=0)))
		if timestamp_time > expire_time:
			return RetVal(ErrBadData, 'bad timestamp')
		return RetVal()
def is_timestamp_valid ( self ) -> RetVal : m = re . match ( r'^([0-9]{4})([0-9]{2})([0-9]{2})$' , self . fields [ 'Expires' ] ) if not m or not _is_valid_date ( int ( m [ 2 ] ) , int ( m [ 3 ] ) , int ( m [ 1 ] ) ) : return RetVal ( ErrBadData , 'bad expiration date' ) expire_time = datetime . datetime ( int ( m [ 1 ] ) , int ( m [ 2 ] ) , int ( m [ 3 ] ) , tzinfo = datetime . timezone ( datetime . timedelta ( hours = 0 ) ) ) m = re . match ( r'^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$' , self . fields [ 'Timestamp' ] ) if not m or not _is_valid_date ( int ( m [ 2 ] ) , int ( m [ 3 ] ) , int ( m [ 1 ] ) , int ( m [ 4 ] ) , int ( m [ 5 ] ) , int ( m [ 6 ] ) ) : return RetVal ( ErrBadData , 'bad timestamp' ) timestamp_time = datetime . datetime ( int ( m [ 1 ] ) , int ( m [ 2 ] ) , int ( m [ 3 ] ) , int ( m [ 4 ] ) , int ( m [ 5 ] ) , int ( m [ 6 ] ) , tzinfo = datetime . timezone ( datetime . timedelta ( hours = 0 ) ) ) if timestamp_time > expire_time : return RetVal ( ErrBadData , 'bad timestamp' ) return RetVal ( )
Checks the validity of the timestamp.
Checks the validity of the timestamp .
'''Checks the validity of the timestamp. As a side effect, it checks the validity of the 
		expiration date field, but it does not check if the entry is actually expired'''
self