def set_time(self, time):
"""Set si station internal time.
@param time: time as a python datetime object.
"""
bintime = (SIReader._to_str(int(time.strftime('%y')), 1)
+ SIReader._to_str(time.month, 1)
+ SIReader._to_str(time.day, 1)
+ SIReader._to_str(((time.isoweekday() % 7) << 1) + time.hour // 12, 1)
+ SIReader._to_str((time.hour % 12) * 3600 + time.minute * 60 + time.second, 2)
+ SIReader._to_str(int(round(time.microsecond / 1000000.0 * 256)), 1)
)
self._send_command(SIReader.C_SET_TIME, bintime)
self.beep()
评论列表
文章目录