def set_unit(self, unit):
<EOL>if unit is None or (isinstance(unit, units.NamedUnit) and<EOL>unit.physical_type == '<STR_LIT:time>'):<EOL><INDENT>self._unit = unit<EOL>return<EOL><DEDENT>if isinstance(unit, Number):<EOL><INDENT>unit = units.Unit(unit * units.second)<EOL><DEDENT>try:<EOL><INDENT>unit = units.Unit(unit)<EOL><DEDENT>except ValueError as exc:<EOL><INDENT>try:<EOL><INDENT>unit = units.Unit(str(unit).rstrip('<STR_LIT:s>'))<EOL><DEDENT>except ValueError:<EOL><INDENT>raise exc<EOL><DEDENT><DEDENT>dec = unit.decompose()<EOL>if dec.bases != [units.second]:<EOL><INDENT>raise ValueError("<STR_LIT>" % unit)<EOL><DEDENT>for other in TIME_UNITS:<EOL><INDENT>if other.decompose().scale == dec.scale:<EOL><INDENT>self._unit = other<EOL>return<EOL><DEDENT><DEDENT>raise ValueError("<STR_LIT>" % unit)<EOL>
Set the GPS step scale