Reading Windows clock


Recommended Posts

I know that DaqFactory only reads the Windows clock at first run and then uses its own precision timer thereafter. Is it possible to read the Windows clock and get this into a variable?

My system displays the current time read from an external device connected via the serial port. I have a button for the user to update the remote device with time derived from DaqFactory but I would like to be able to update from the current windows time as an alternative.

Thanks,

Martin

Link to comment
Share on other sites

I unzipped the UserTime.Zip and renamed the .dll file as "GetWinTime.dll" and placed this in my DaqFactory directory. In my initialization routines I put:

Extern("C:\DaqFactory\GetWinTime.dll","double GetWinTime(void)","GetWinTime","stdcall","Gets the windows clock")

Then in the first line of the action for the button that was to get the windows time I put:

TempVM1Time = GetWinTime()

When the button is pressed the alert:

C1000 Channel or function not found: Line 1 - Unable to perform quick sequence action

is displayed.

So what is wrong with my Extern() declaration.

Martin

Link to comment
Share on other sites

No. I have just tried it in the command window with the void removed so there are just empty bracckets and I also took out the optional tip. Under these conditions it generates C1000. Watching GetWinTime() gives C1000.

Link to comment
Share on other sites

Found It!

The Extern call should be:

Extern("C:\DaqFactory\GetWinTime.dll","double GetTime()","GetWinTime","stdcall")

whereas I had "double GetWinTime()" as the second parameter

Seems to work now, at least in the watch window.

Martin

Link to comment
Share on other sites

Archived

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