swRTC

tochinet:
Hi Leo,

I really love swRTC. I recently added a getDeltaT method (and issued a pull request on github).
Reason is that I integrated swRTC with panstamp SWAP stack from Daniel Berenguer, and I need to be able to read that and report it over RF network. I didn't test it yet though.

I also added an overloaded setDeltaT method using a int instead of float because float is supposed to be quite inefficient. But the weird thing is that when I substitute it to your routine, I get about 300 bytes MORE with my sketch. Very strange. Anybody have an idea on why and what did I do wrong ?

Hi tochinet, sorry if I read and answer a little bit late :sweat_smile:
We had a msg exchange over Github. Just to inform you that the new code I've put online a week ago seems to me that is more efficent and generates a smaller code.
Can you confirm this?

I also noted that the maximum deviation supported is 1% (840.0 second a day). Is there something specific that defineds that as a hard limit ? Because it pretty much looks like my device (using the internal 8MHz clock) derives more than that, my latest calculation would say around 1512 seconds too much a day (or 1.75%). Can this limitation be relaxed to 2-3% without any side effect ?

That's only a choice of mine. I decided not to use bigger values.
With the last revision of swRTC I used an int type so you can extend the range between -16384 and +16383 tenths of second a day.
If you want a bigger range, try using a long int, but it doubles the RAM usage (4 bytes) and, probably, the size of the sketch.