LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time synchronization between two computers

Hi,

I have two computers, one is a laptop running LabView 8.5 which digitizes and acquires various channels of analog data (through a cDAQ using 9239 and 9237 modules).  The second computer is a dedicated DVR-based "security system" PC.  This security system PC was purchased with the intent of recording mulitiple video streams from cameras and storing them on the PC's hard drive.  After some internet research, buying a seperate DVR-based security system PC (for example from this site http://www.cctvsentry.com/) seemed like the best option for the money and effort required.  Anyways, it's just a Windows-based PC that records 8 camera streams and saves them as *.avi files with the time displayed on the video stream.  This system gets its time-stamp from the Windows-clock. 

On my LabView-running LabView, I am saving my data so that the filename includes the time that the file starting recording, which is also a windows-based time.  There is a strong desire to have the video and data records to be on the same (as much as possible) clock, and off only by a few (maybe 100 or less) milliseconds.  I understand that I could purchase a hardware-based "time server" but would prefer not do for sake of simplicity and cost.  Also, the main desire is not to have each computer's clock be incredibly accurate to the "true" time, but instead just for the two computer's clock to be very much in sync with one another. 

I have found what appeared to be a very helpful Windows link describing how to set one computer up as an "authoritative time server" and the other up as a "client" and then have the two computers (both running Windows XP) communicate and sync up over a cross-over ethernet cable: 

http://support.microsoft.com/kb/314054/

Unfortunately, I haven't been able to get this to work. 

Is there an easy way to sync up the system clocks for both computers?  It seems this must have been done before, as I'm sure many people want data from various computers and DAQ systems to have nearly identical time-stamps. 

Thanks,

Ben
0 Kudos
Message 1 of 10
(13,769 Views)
Hi, Ben,
"Time-server" based solution will work, sure, but this is complicated to get it running.
Probably easiest way is to call SetLocalTime (or SetSytemTime) function from kernel32.dll?
 
best regards,
Andrey.
0 Kudos
Message 2 of 10
(13,762 Views)
Ben,
 
It depends how accurate you want the sync up. If you are willing to have it in the 1 to .1 sec range, I would suggest you go to NIST and download their NTTP software. There you can sync the machines up to NIST time every day or so.
 
I am not sure about windows, but Linux and Unix base system allows NTTP to correct the clock time on the machine, making it more accurate. If you need the times in usec, you will start needing special equipmen. You can use GPS. I understand, it is accurate to the usec level.
0 Kudos
Message 3 of 10
(13,749 Views)
I understand that using an internet time server sync's up the comp's windows time using NTP.  The only issue with using one of the internet time servers (like NIST) is that I would prefer to sync these computers up in the field where they do not have access to the internet. 

Actually because of our strange gov't computer system, these computers are not even normally configured to be connected to the internet (though they could be).   Is there no easy LabView VI that could communicate via RS232 or ethernet to sync the local windows clock of two seperate computers? 
0 Kudos
Message 4 of 10
(13,747 Views)

Ben,

You should have mentioned that. In addition, you should mention what kind of operating system. As the other post mention, you will need to make one of the computers a time server. Then schedule a periodic update on the other computer to sync with the computer. These are features in the windows computer.

0 Kudos
Message 5 of 10
(13,723 Views)
In the first post I mentioned that both computers are running windows XP.  I have tried to set up one as being the "authoritative time server" and the other as the client, and using the windows clock to sync the two up via a cross-over cable but I haven't gotten it to work.

http://support.microsoft.com/kb/314054/

This post basically shows how to edit the registry editor and then connect the two using a crossover cable, and then to sync one with the other.  For some reason it hasn't worked for me.  Maybe I just need to keep trying, but I figured there might be another way to do it. 
0 Kudos
Message 6 of 10
(13,717 Views)

Try this to create your own ntp server

http://www.cis.udel.edu/~mills/ntp/html/hints/winnt.html

Then you can use a standard ntp client to sync your clock.

0 Kudos
Message 7 of 10
(13,705 Views)

I know this is a couple of years late, but since there was no update showing the final solution, I thought I would offer a comment.  I have a very similar requirement, with slightly less lenient a threshold on the time synch.  I have two PCs running Windows 7; they are connected to the same network.  I could not get one to act as a time slave and one as a time master using Windows commands.  What I have done so far is this:

 

Call 1 PC Time Server, and one Time Client for the sake of simplicity.

 

VI on Time Client opens a TCP/IP listener, Time Server opens a connection to the Time Client.  As soon as the connection is opened the Time Server uses the GetSystemTime function from kernel32.dll and sends this 16 Byte cluster to the Time Client which then immediately calls SetSystemTime function from kernel32.dll  

Then to check the Time Client takes a time stamp (LabVIEW VI) and sends it to the Time Server on the same connection.  The Time Server takes its own timestamp after the TCP read has finished and as the cluster is being unflattened and the two are compared (simple numerical subtraction).  This seems to reliably get the difference down to about .1 ms

 

If anyone has a more rigorous solution I would love to know it, since this only keeps them that closely synched for a few hours at the most.

 

0 Kudos
Message 8 of 10
(12,323 Views)
I haven't tried this since the Windows 98SE days, but I used to schedule a Windows task, where the command line was : 'net time \\timeserver /set /yes' (leave out the quotes), where timeserver is the network name or IP address of the PC that will be the keeper of the time. You can set this task to run as often as you like, and it is independent of LabVIEW.
0 Kudos
Message 9 of 10
(12,251 Views)
You should consider getting a couple o cheap gps unit. You could tie it in with the NEA cabls. That shoud pull you within 10 millisecond range without any problems.
0 Kudos
Message 10 of 10
(12,247 Views)