Skip to content

A MicroPython library for synchronizing and setting time. 用于同步时间和设置时间的MicroPython库

License

Notifications You must be signed in to change notification settings

funnygeeker/micropython-easytime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

简体中文 (Chinese)

micropython-easytime

A time management module for micropython that allows for easy setting, retrieving, and synchronizing of time.

Code Example

from lib.easytime import EasyTime

et = EasyTime(time_zone=8, datetime=(2023, 1, 1, 6, 0, 0, 0, 0))

# Get the current time
print(et.time())
# (2023, 1, 1, 6, 0, 0, 0, 226)

# Set the current time
print(et.time((2023, 1, 1, 6, 1, 0, 0, 0)))
# None

# Set the current year
print(et.year(2022))
# None

# Get the current year
print(et.year())
# 2023

# Get the current month
print(et.month())
# 1

# For more details, please refer to the source code. This is just an example.
# Synchronize time from NTP time server (Please connect to the network first)
# et.sync()

Notes

References

Github - PyClock: https://github.com/01studio-lab/pyClock

MicroPython - Docs: https://docs.micropython.org/en/latest/library/pyb.RTC.html

About

A MicroPython library for synchronizing and setting time. 用于同步时间和设置时间的MicroPython库

Topics

Resources

License

Stars

Watchers

Forks

Languages