My issue is that, when I pass the timestamp through utime.localtime it returns a date 30 years in the future. When I pass the date tuple back through utime.mktime it returns to the proper timestamp. I have confirmed that the timestamp is correct independently.
Why is utime.localtime() converting the date incorrectly? How can I fix that? OR Is there a better way to get the current date and time as a string?
Here is a sample:
Code: Select all
>>> import utime
>>> currently = utime.localtime()
>>> print(currently)
(2000, 1, 1, 0, 20, 8, 5, 1)
>>> utime.mktime(currently)
1208
>>> epoch = 1490014068
>>> utime.localtime(epoch)
(2047, 3, 20, 12, 47, 48, 2, 79)
>>> utime.mktime((2047, 3, 20, 12, 47, 48, 2, 79))
1490014068
Running v1.8.7 on an Adafruit Feather Huzzah