-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]: Why do we use yOff instead use the Year In DateTime? #93
Comments
We do this because the DS3231 holds the year in a two-byte register. (One byte per 8-bit int, so it holds two decimal integers.) We could of course change how we instantiate it to keep DateTime::DateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec) {
if (year >= 2000)
year -= 2000;
yOff = year; |
Hi Andy thank you for the feedback. I found that some things in the constructor could be simplyfied a bit. Also I thought about the point save all members in a struct tm instead of using uint_8 variables. How do you think about this? |
@awickert see an over view here. So the constructors will get more cleaner than now. |
@awickert The one constructor which looks like this:
will result in this:
With the class declaration like:
|
@awickert @IowaDave
Why do we use the
yOff
instead using the hole year number (e.g. 2023) in the DateTime Class?Is ist possible to switch to use the year?
I would sugest to switch to
uint16_t year
as Data member for
DateTime
so no year information is lost.Or maybee better to add the full year as Data member.
To be able to recalculate timesstanps in a way.
I could provide a solution.
The text was updated successfully, but these errors were encountered: