NTP Time calculating
Mistake is to use floating point numbers here as precision of 1 is needed. With floating point numbers there will be rounding errors and for example 32-bit floats do not have precision of 1 any more at values larger than 16777215.
I don't have the same rounding problem on my PC, but a different one:

3776579879 -&gt; 9:57:59
3776579880 -&gt; 10:58:0
3776579999 -&gt; 10:59:59
3776580000 -&gt; 10:0:0