I'm not sure that I understand what your problem is, but, the first value that you print is done this way:
There will be truncation as a result of the division, ...
Would you try again to explain what your problem is, if this is not the culprit?
Thanks for looking at it. That's not the problem, I understand the variable type and rounding but that part is working fine.
The code waits for you to type "~" then sets the clock to 13:22:00, then immediately prints out the time once a second for 5 seconds. It also prints the millis counter (divided by 1000) as a reference. I expect the time printout to look like 13:22:00, 13:22:01, 13:22:02...13:22:05. I understand that with excecution times etc it might miss a second every now and then and am not worried about that either.
What I consistently get is the clock set to the 13:22:00 plus the time difference between the last clock print time from millis() and the current time from millis(). For example, the first set of data ends with a millis of 10e3, and the second set starts with millis of 19e3 (10 and 19 in the left column), and the second clock printouts are 9 seconds fast. Further down the there is a printout at 32 seconds then a clock setting at 75 seconds, and the clock is set 43 seconds fast (to 13:22:43). You can subtract the number on the left below the ----- from the number on the left above the ----- and predict how far off the clock setting will be.
I seem to be missing an activate/set/do it now!!! sort of command; my clock setting using setTime doesn't happen until sometime later.
I did switch to the old DateTime library and got this working just fine. Are there any bugs with the DateTime library or was it abandoned because there are more features in Time?
Thanks,
-Mike