UIFlow Guide
通过网络服务器读取当前时间, 注: 当程序download离线运行时,需要在NTP初始化程序前,添加WiFi连接程序,使得设备连接网络。
from m5stack import *
from m5ui import *
from uiflow import *
import ntptime
import time
setScreenColor(0x222222)
ntp = ntptime.client(host='cn.pool.ntp.org', timezone=8)
while True:
print(ntp.formatDatetime('-', ':'))
print(ntp.getTimestamp())
wait(1)
wait_ms(2)
import ntptime
ntp = ntptime.client(host='cn.pool.ntp.org', timezone=8)
cn.pool.ntp.org
jp.pool.ntp.org
sg.pool.ntp.org
tw.pool.ntp.org
hk.pool.ntp.org
us.pool.ntp.org
de.pool.ntp.org
ntp.formatDate('-')
ntp.formatTime(':')
ntp.formatDatetime('-', ':')
ntp.getTimestamp()
ntp.year()
ntp.month()
ntp.weekday()
ntp.day()
ntp.hour()
ntp.minute()
ntp.second()