The variable DriftSeconds holds the "quantity" of second your clock is going to drift in DriftDays days. So if you clock is 6 sec/day fast you have to set:
di.DriftDays = 1;
di.DriftSeconds = 6;
If you clock was slow by 6 it should be (signed):
di.DriftDays = 1;
di.DriftSeconds = -6;
If you a have a not integer number of seconds you can multiply both variable by the same factor. So for example if you have 25.67 sec/day:
di.DriftDays = 100;
di.DriftSeconds = 2567;
In the internal of the library those 2 variables will be divided by each other:
float driftCorrection = float(rtcTime - driftInfo.DriftStart);
driftCorrection /= float(SECS_PER_DAY * driftInfo.DriftDays);
driftCorrection *= float(driftInfo.DriftSeconds);
In driftCorrection you will have the floating point number of seconds per day of you drift, which is then used to calculate the current time:
// due to conversion of driftCorrection to long, accuracy of time returned is +/- 0.5sec
time_t curTime = rtcTime - long(driftCorrection);
I have to make clear that this is not my code, but I took it from the blog post above
http://limchonghan.wordpress.com/driftcorrectedds1307/. But I have tested and I'm using in a project so I can say that is working. ![]()