Clock on ESP-12F gives wrong time

206 views Asked by At
  1. I connect the ESP-12F to the Linux machine on USB0 port.

  2. From Linux console login into ESP-12F.

    $ picocom /dev/ttyUSB0 -b115200
    
  3. Set the clock using MicroPython:

    >>> import utime
    >>> import machine
    >>> time=(2021, 11, 21, 23, 42, 0, 6, 325)
    >>> machine.RTC().datetime(time)
    >>> utime.localtime()
    (2021, 11, 22, 18, 0, 11, 0, 326)
    

Time changed and the day as well. ~19 hours was added to the time I wanted. What did I do wrong? I do not want to synchronize, just to set.

1

There are 1 answers

0
akoel On

I found the answer for my question.

...The documentation is wrong... Parameter 4 is the day of week..."

The 8-tuple has the following format: (year, month, day, weekday, hours, minutes, seconds, sub-seconds)

(0) year includes the century (for example 2020)
(1) month is 1-12
(2) mday is 1-31 or yday 1-365/366
(3) weekday is 0-6 for Mon-Sun ***Set to 0, being Auto Set by machine
(4) hour is 0-23
(5) minute is 0-59
(6) second is 0-59
(7) sub-seconds