[time-nuts] Thunderbolt/PC C# system time sync

Dan Quigley dquigley at msn.com
Sun Nov 8 05:29:06 UTC 2009


Hello - new to the list here. 

I am developing a c# (.net) class to encapsulate the TSIP protocol. An issue
I ran across is how to accurately sync the system time running Windows with
the time packets from a Thunderbolt. I've noticed that setting the OS system
time with the time indicated in the TSIP primary timing report can create a
noticeable accuracy difference between a PC's system time if not biased.

I've compensated for that using a difference in Tick counts from the system
and the time value reported by GPS.   Here is the relevant code:

      current_time = new DateTime(stime.Year, stime.Month, stime.Day,
stime.Hour, stime.Minute, stime.Second);
      DateTime d = DateTime.Now;

      // set system time once each minute if desired
      if ((set_system_time) && (stime.Second == 0))
      {
         long td = (current_time.Ticks - d.Ticks) / 1000000000L;
         stime.Milliseconds = (short)td; // advance the clock by diff in
tick count
         Win32.SetSystemTime(ref stime);
      }

My question to the list is: Does anyone have experience with this issue and
a better solution?

Thanks in advance,
Dan Quigley (N7HQ)





More information about the time-nuts mailing list