Windows or DF Time - Revisited


ccdubs

Recommended Posts

Hi all,

I recently installed the dll for DF to use windows time for an existing application. The reason was that the main page displayed the current time and that this would lag real time and DF would need restarting about once a week to correct the time.

Using windows time is now causing problems with some of my sequence timing and I have traced this back to the automatic internet time updates (which our client wants to keep). I expect the same issues when daylight savings time kicks in.

I realise that this is one of the reasons why DF uses it's own time but it would be really useful if DF would have the option of using both. I could therefore display current windows time on the main page but still use DF timing for my sequences. Any chance of this happening or way around it at the moment.

Cheers

Link to comment
Share on other sites

Yes, you have discovered one of the reasons we use a different clock. The other reason is that the windows system clock is only precise to 15ms (depending on OS version) and the clock we use is presice to 100 nanoseconds.

You can actually just use the usertime.dll to retrieve the time manually. First you need to rename it to something other than "usertime" (keep the .dll). Then use the extern() statement to load it in manually. Something like:

extern("gettime.dll", "double gettime()","gettime","stdcall")

This makes a new function gettime() that will return the windows time. I didn't try it, but this should work.

Link to comment
Share on other sites

No your post didn't go through.

Sorry, two things:

1) its "double GetTime()". C is case sensitive, unlike DF

2) we can't call our function gettime in DF because this is a built in function, so use GetSysTime or something.

So, it ends up being:

extern("gettime.dll", "double GetTime()","getsystime","stdcall")

Link to comment
Share on other sites

  • 1 month later...

Are we talking the getsystime() function from gettime.dll (usertime.dll)?

Anyhow, not sure when we added it, I guess after your posts, but the latest version of DAQFactory has a function called System.IsDST() which will return 1 if in DST and 0 if not. You might use that instead. The problem is you have to check whether you are in DST when your application loads since DF uses whatever the system time is on startup. So, in an autostart you might do:

global initDST = system.isDST()

then, anywhere you display time, you'd use:

time + 3600 * (system.isDST() - initDST)

where time is whatever variable has the time you want to display.

Link to comment
Share on other sites

I'm not competely sure what Windows is going to do in its low level calls. I'd use the method I mentioned with IsDST() that way you have control. This also makes it so you can detect when the transition happens and do some extra steps to ensure things in your system don't go haywire.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.