Skip to content

set individual values of the RtcDateTime object #181

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

You must be logged in to vote

Nope, this is on purpose. Its an optimization. Just construct a temp. When the compiler knows its members are not directly accessible it can do some optimizations. Further, there are details for incrementing that can cause invalid dates if you use daylight shifting (which I do not recommend except where you display or take input). But adding seconds will never do this.

Take this example which does compile successfully and works for most cases, as it assumes you want the last day of the next month if the day is beyond a valid day of the month.
NOTE: DaysInMonth is coming shortly to wrap the access to progmem c_daysInMonth for easier readability

                    uint16_t year = when.Year…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Makuna
Comment options

Answer selected by Iceteavanill
Comment options

You must be logged in to vote
1 reply
@Makuna
Comment options

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