Not sure if this is the answer to your specific problem, but the GetSync function calculates the remaining time up to a full minute.
This should be (if I haven't missed something, which is entirely possible):
private static double GetSync(int syncTime) { DateTime now = DateTime.Now; return ((2 * syncTime) - now.Second) * 1000) - now.Millisecond; }
This may solve your problem, since calculating the remaining time this way will never return 0 from GetSync.
EDIT: Incorrect calculation added 2 * synchronization time, which will calculate it correctly if I understand it correctly.
source share