I'm using the RTC and its functions to display the time. Every time the button is pushed, I want to set the time five minutes ahead of the current time.
I thought the following would work fine:
Code: Select all
t = rtc.datetime()
timestamp = time.mktime(t)
timestamp = timestamp + 300
rtc.datetime(time.localtime(timestamp))
Have a look at this output from my code in debugging. I've just added ONE second to the timestamp now, instead of 300.
Code: Select all
Current time tuple
(2021, 10, 31, 6, 23, 44, 18, 0)
Current timestamp
1635661424
Added one second
1635661425
New time tuple
(2021, 10, 31, 6, 23, 45, 6, 304)