ccdubs Posted August 13, 2009 Share Posted August 13, 2009 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 More sharing options...
AzeoTech Posted August 13, 2009 Share Posted August 13, 2009 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 More sharing options...
ccdubs Posted August 14, 2009 Author Share Posted August 14, 2009 Not sure if my last post went through or not but I can't make this work. Is the prototype correct? Link to comment Share on other sites More sharing options...
AzeoTech Posted August 15, 2009 Share Posted August 15, 2009 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 More sharing options...
ccdubs Posted August 16, 2009 Author Share Posted August 16, 2009 Thanks it works well and is a good resolution to my issue. Link to comment Share on other sites More sharing options...
ccdubs Posted September 26, 2009 Author Share Posted September 26, 2009 This issue won't die....day light saving time kicked in today and while the PC clock updated, the GetTime() function didn't. It took a DF restart to get this corrected. Link to comment Share on other sites More sharing options...
AzeoTech Posted September 27, 2009 Share Posted September 27, 2009 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 More sharing options...
ccdubs Posted September 29, 2009 Author Share Posted September 29, 2009 Sorry, yes I am referring to the GetSysTime function. So from your response it would seem that it would be expected that DST wouldn't have automatically updated and I need to implement code to make it that way? Link to comment Share on other sites More sharing options...
AzeoTech Posted September 29, 2009 Share Posted September 29, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.