Daqfactory Time


zpayne01

Recommended Posts

Hello,

I run a fairly complicated setup that uses multiple computers and microprocessors to run a sampling protocol alongside an instrument that uses DAQfactory attached to a Labjack. I check to make sure times are synched between the different computers several times per day, however, once DAQfactory has started, it seems to run on its own internal clock separate from the windows clock. This causes it to start lagging (3-5 seconds a day) which eventually forces a restart of the program. I was wondering if there was a way to get DAQfactory to sync automatically to the outside computer without forcing a complete restart.

 

Thank you,

Zachary Payne

Link to comment
Share on other sites

Yes, DAQFactory uses the high precision clock inside Windows.  On most systems this doesn't really drift, but on some we have seen the sort of 3-5 seconds a day drift.  I'm not quite sure why that is, but I believe it has something to do with the chip used for the sound card as the high precision clock is driven by this chip.  Anyhow, there is a DLL you can use called UserTime.dll that will replace DAQFactory's internal clock with the one in the DLL.  Technically you can create your own DLL, or you can just use the one we have created.  A search for usertime on this forum yields a lot of information, including this one which has the .zip file with the DLL:

The UserTime.dll we created here simply uses the low precision clock that is connected to the one you normally see in Windows.  Note that unlike DAQFactory's normal clock, this clock will shift for DST or any other changes in the system clock.  This can cause problems in your scripts.  For example, when you do delay(1), DAQFactory records the time, adds one second and waits until that absolute time.  If DST kicks in during that period and falls back, delay(1) basically turns into delay(3601) because the clock jumped back an hour.

Link to comment
Share on other sites

Interesting, so are you saying when I have events that occur every 60 seconds (time 60 within a script with goto 0 afterward), if the clock changes (due to daily syncs), then it will account for this change (hypothetically the clock adjusts by 4 seconds at midnight so 4 seconds are added within the script)? Also, since I record data every second and each data point has a string associated with the time of the recording, will the new data be written with the new time after a sync, or will it continue with the old time point (I assume the former)? 

Link to comment
Share on other sites

Depends.  If you run DAQFactory normally, changes in the system time do not affect anything inside DAQFactory.  But if you use UserTime.dll which utilizes the system clock, then changes in the system clock will cause DAQFactory to behave differently because its only reference is that clock that is shifting.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.