Skip to content

adjust the time by pressing buttons #146

Answered by Makuna
allfallsdow asked this question in Q&A
Discussion options

You must be logged in to vote

What do you mean by "adjust the time second by second"?
Do you mean set the time? Almost every example demonstrates setting the time.

RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__); // instantiate a RtcDateTime with the new Date and Time you want (many ways)
Rtc.SetDateTime(compiled); // apply that RtcDateTime instance to the RTC module

If you mean, modify the existing time, then

RtcDateTime modify = Rtc.GetDateTime(); // get current date and time
modify += 60; // add 60 seconds
Rtc.SetDateTime(modify); // apply that modified instance to the RTC module

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Makuna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants