How to use machine.RTC.ntp_sync() function?

Viewed 41

问题描述


I'm using time.ntp_sync() function. But getting the error "please use machine.RTC.ntp_sync() instead time.ntp_sync()".
There is no example/reference about machine.RTC.ntp_sync().

硬件板卡


CanMV K230 V3.0

软件版本


CanMV_K230_V3P0_micropython_v1.4-0-g6cce59c_nncase

2 Answers
from machine import RTC

# 实例化RTC
rtc = RTC()

rtc.ntp_sync()

Any way to set timezone for rtc? By default it is taking GMT+8.

@xelll Can you please check?

from machine import RTC

# 实例化RTC
rtc = RTC()
rtc.timezone()