rtc.py 554 B

1234567891011121314151617
  1. #
  2. # Copyright (c) 2006-2019, RT-Thread Development Team
  3. #
  4. # SPDX-License-Identifier: MIT License
  5. #
  6. # Change Logs:
  7. # Date Author Notes
  8. # 2019-06-13 SummerGift first version
  9. #
  10. from machine import RTC
  11. rtc = RTC() # Create an RTC device object
  12. rtc.init((2019,6,5,2,10,22,30,0)) # Set initialization time
  13. print(rtc.now()) # Get the current time
  14. rtc.deinit() # Reset time to January 1, 2015
  15. print(rtc.now()) # Get the current time