Hello,
I have rewritten my RTC-Library [now Version 1.1.0] for the Due so that the function-calls are similar or more like other RTC-Librarys (like the for the DS1307 or RTCZero), and btw. I add support for the Timezone-Library from JChristensen thanks to kapyaar for that Idea, also I cleaned some Code and grab some lines from RTCZero and add more comments and new Examples.
I hope you can enjoy the new Version the old one is still available, but wouldn't neat after this.
My impulse was rewrite to make it easyer to migrate from or to the Due.
Link to the home of the new Lib, as direct link.
Now inside the Library Manager too.
BR
Markus
Sorry bad named zip.
RTCDue.zip (19 KB)
Have you checked and verified that the library returns time_t correctly as a unixtime?
Here's the problem I've encountered. I'm using the rtc_clock library in a data logger. I push the collected data into a database and then join sets of data together based on the unixtime stamps. I just noticed recently that there was a LARGE time shift between data from various boards. The DUE RTC Library "rtc_clock.unixtime()" returns a value that is about 35 days into the future.!!!
Here is an example comparison:
**** Time: 19:19:27.406 Date: 14/8/2016 Fix: 1 quality: 2 Location: 47xxxxxN, 12xxxxxW Speed (knots): 0.01 Angle: 17.08 Altitude: 80.70 Satellites: 7
GPS unixtime: 46 1471202367 rtc_unixtime: 1474201121
If you plug the GPS unixtime value into any of the online converters for time... it correctly returns the date 14/8/2016 and the correct time (UTC).
But the rtc time value 1474201121 when converted back returns the data as
1474201121
Is equivalent to:
09/18/2016 @ 12:18pm (UTC)
2016-09-18T12:18:41+00:00 in ISO 8601
Sun, 18 Sep 2016 12:18:41 +0000 in RFC 822, 1036, 1123, 2822
If I ONLY use the RTC library to pull the hour, minute, seconds, day, month, year... the resulting text appears reasonable - e.g. the conversion from the internal data to human values uses the same algorthim ... but the conversion to unixtime is incorrect.
Sunday, 18-Sep-16 12:18:41 UTC in RFC 2822
I just tried the latest version of RTCDue - not the older library. It looks like the problem with unixtime not being unixtime was corrected.
Heidnerd:
I just tried the latest version of RTCDue - not the older library. It looks like the problem with unixtime not being unixtime was corrected.
Yes I know this bug, I hope so that I have corrected it, successfully. There was a bug inside the unixtime function in the part of the switchyear calculation, introduced with a change of the calculation, sorry for that.
Btw.: On the latest Version of the "old" library this is also corrected.
@Markus_L811
This library looks interesting to me but I'm struggling.
I would like to use the RTC to log a time when an interrupt occurs, I'm happy with the interrupt etc but am struggling recovering the the time from the RTC into a variable to store it.
Can you offer any advice?
Thanks
Chris
ChrisLewis:
@Markus_L811
This library looks interesting to me but I'm struggling.
I would like to use the RTC to log a time when an interrupt occurs, I'm happy with the interrupt etc but am struggling recovering the the time from the RTC into a variable to store it.
Can you offer any advice?
Thanks
Chris
Maybe, can you post some more details? Programcode?