1 Star 0 Fork 18

lvyh/Air-Sensor

forked from FriBox/Air-Sensor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
FB_NTP.py 603 Bytes
一键复制 编辑 原始数据 按行查看 历史
FriBox Open Source 提交于 2022-07-27 20:22 . 20220727
import utime,FB_Ntptime;
def NtpSync(inTimeZone=+8):
NtpErrs=0;
FB_NtptimeTF=False;
while NtpErrs<10:
try:
utime.sleep_ms(480);
FB_Ntptime.settime();
print(' # >> NTP >> Sync DateTime',utime.localtime(utime.mktime(utime.localtime()) + inTimeZone*3600));
FB_NtptimeTF=True
utime.sleep_ms(10);
break;
except:
FB_NtptimeTF=False
print(' # >> NTP >> ERR : ',utime.localtime(utime.mktime(utime.localtime()) + inTimeZone*3600));
NtpErrs=NtpErrs+1;
return FB_NtptimeTF
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/testos/Air-Sensor.git
git@gitee.com:testos/Air-Sensor.git
testos
Air-Sensor
Air-Sensor
main

搜索帮助