PuceBaboon / ESP8266-DS3231

Using a DS3231 to supply power to an ESP8266 ("no-power" deep sleep)
The Unlicense
9 stars 6 forks source link

Output Year is incorrect #2

Open 1CM69 opened 5 years ago

1CM69 commented 5 years ago

Hi, not that it really alters the running of the sketch in anyway but more of a looks type of issue, the year output is off by 100 years.

My RTC is initially setup via NTP:

Untitled

visible in the above image is the output from running my sketch to get time from NTP, yes the time is an hour behind PC time as my NTP time is set to GMT but you can see that the year is correct at 2019.

In the image below it shows the date & time output from this sketch, you can see that the year is now 1919 but the month, day & time is correct.

Untitled2

Any ideas?

Thanks

1CM69 commented 5 years ago

Could it be something very simple as the formatting of the date i.e. from the NTP my date is formatted as DDMMYYYY using this sketch the date is formatted as YYYYMMDD

Perhaps it is confusing the issue as the day is the 19th and the short year YY is also 19.

Maybe tomorrow it will be more apparent i.e.

it may show as 1919-08-20 or 1920-08-19.....

PuceBaboon commented 5 years ago

Brian,

If you're still having problems with this, I recommend searching for the "Cave Pearl" project and then looking at his DS3231 pages. Ed has done a ton of work (over years) on integrating all of the great tips on both hardware, software and testing of the Chinese made, DS3231 modules. Apart from anything else, it's a great read.

         -John-

On Mon, 19 Aug 2019 at 18:00, 1CM69 notifications@github.com wrote:

Could it be something very simple as the formatting of the date i.e. from the NTP my date is formatted as DDMMYYYY using this sketch the date is formatted as YYYYMMDD

Perhaps it is confusing the issue as the day is the 19th and the short year YY is also 19.

Maybe tomorrow it will be more apparent i.e.

it may show as 1919-08-20 or 1920-08-19.....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PuceBaboon/ESP8266-DS3231/issues/2?email_source=notifications&email_token=ACRO2WOJG3LTUFT7YYOHMHDQFJOJ3A5CNFSM4IM2HAGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4SGLXA#issuecomment-522479068, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRO2WKN5MMXIPQJZUWIHITQFJOJ3ANCNFSM4IM2HAGA .

1CM69 commented 5 years ago

I found this thread on arduino.cc forum:

https://forum.arduino.cc/index.php?topic=295768.0

It’s the same year issue I am having with the Rodan library, I’ll try the suggested fix & report back.

1CM69 commented 5 years ago

I made the changes as outlined in the thread in the above post and now the year is showing correctly.

Meins321 commented 2 years ago

So you did this to Fix:

Apr. '15 gilbertg: I tried the other lib guix mentioned. A boat load of compile errors. I looked in the original lib to see where it added the 1900, and I don’t have enough experience to notice it. I’m a total noob, so I’ll stick my nose back in the books and get some more learning under my belt. I don’t expect anyone to do it for me. Thanks again Very Much for the quick replies! Don’t worry…I’ll be back with more questions, I promise! :’)

I had the same problem today. I found the DS3231.ccp file had mention of the year 1900. I’m not good with libraries (Noobie), but I replaced 1900 on line 76 with 2000, as well as line 117, then saved the file. No idea what I did, but the date now comes up as [2015.](url)

PS. It has fixed one problem, but may have stuffed up a future one (my guess is turn of the century 2100). But my guess is that no one will be using this code then. We’ll probably program thru our home robotic assistance, or maybe in layman’s language (via Siri) or maybe even telepathically!

DS3231.cpp (9.79 KB)

DS3231.cpp.zip

PuceBaboon commented 2 years ago

Hi Meins321, Brian,

Funnily enough, I've been doing a little bit more work with various versions of this project recently and, mainly because of maintenance issues, have swapped over to using the Adafruit RTClib library instead of the Rodan one. It's not very difficult to modify the code and you can check https://github.com/PuceBaboon/ESP-DigiClock for hints on how to use it.

If we get another big snow storm, I might have enough time on my hands to go back and update this project, but no promises on a timeline I'm afraid. Here's the library.properties info from RTClib:-

RTClib

version=1.11.2 author=Adafruit maintainer=Adafruit info@adafruit.com sentence=A fork of Jeelab's fantastic RTC library paragraph=A fork of Jeelab's fantastic RTC library category=Timing url=https://github.com/adafruit/RTClib architectures=* depends=TinyWireM

-John-