LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Importing DLLs

Hi there !

I want to use the "GetSystemTime" / "GetLocalTime" function of the
system DLL "kernel32.dll" (WINNT). One of these functions I need for
getting a time information including milli-seconds.
These functions are called with a parameter pointing to a structure
"SYSTEMTIME".

Unfortunately I have not found the right configuration of the
"call library funtion" block.

Can anyone help me?

Thanks

Hans Joerg
0 Kudos
Message 1 of 5
(3,207 Views)
Don't know exactly but the ni ftp site has a good example library for
system32 calls. It may even have this function already written.

Jim

"H.J. Beestermoeller" wrote:

> Hi there !
>
> I want to use the "GetSystemTime" / "GetLocalTime" function of the
> system DLL "kernel32.dll" (WINNT). One of these functions I need for
> getting a time information including milli-seconds.
> These functions are called with a parameter pointing to a structure
> "SYSTEMTIME".
>
> Unfortunately I have not found the right configuration of the
> "call library funtion" block.
>
> Can anyone help me?
>
> Thanks
>
> Hans Joerg
0 Kudos
Message 2 of 5
(3,207 Views)
Set the Calling Convention to stdcall(WINAPI).
Set the return type to void.
Create one parameter and set its type to "adapt to type".
Create a cluster constant of eight unsigned 16-bit integers and wire it
to the input.


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
0 Kudos
Message 3 of 5
(3,207 Views)
"H.J. Beestermoeller" wrote:

> I want to use the "GetSystemTime" / "GetLocalTime" function of the
> system DLL "kernel32.dll" (WINNT). One of these functions I need for
> getting a time information including milli-seconds.
> These functions are called with a parameter pointing to a structure
> "SYSTEMTIME".

I imagine Greg will pipe up if I'm wrong, but I'm pretty sure that the
Get Date/Time in Seconds primitive in LabVIEW calls the very DLL to
which you refer under Win32. There have been discussions on
Info-LabVIEW about this, and I'll try to paraphrase what I recall:

The Get Date/Time in Seconds primitive will give you an absolute time
with subsecond accuracy down to 55 ms under Win32. You can't really do
better than that under Win32 when it comes to absolute time.
What you
can do is access the OS timer (accurate to 1 ms) by using the Tick Count
(ms) primitive, but that rolls over every 49.7 days and thus is more
useful for determining accurate differences over relatively short
periods of time (say, benchmarking LabVIEW code).

If you want to try to combine the two primitives to come up with a
pseudo-absolute timestamp accurate to 1 ms, you're welcome to try, but
you'd probably be better off simply using Get Date/Time in Seconds and
living with the 55 ms accuracy.

There's a good example of a timestamp w/ milliseconds on the NI site:

http://digital.ni.com/explprog.nsf/websearch/96a848dea235e3bd8625671e0026e479

Regards,
John Lum
National Instruments
0 Kudos
Message 4 of 5
(3,207 Views)
Sure can, Hans. I am including 2 VIs which should do the trick. They're documented with the how to, but they're pretty self explanatory.
Current System Time or Local Time
Use Win32 API Function GetSystemTime. You must supply a SYSTEMTIME structure to the function. The structure is as follows: (Integer is a 16 bit signed integer)
Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
That's the only argument either GetSystemTime or GetLocalTime take. You can pass a cluster using 'adapt to type' in the pull down menu of the Config... dialog of the Call Library Function
. The VIs give an example, and should solve the problem outright; they're already configured as subVIs for inclusion in your hierarchy.
Hope they help
John Wilson
Sanders Engineering
johnwilson@pctechnician.net
Download All
0 Kudos
Message 5 of 5
(3,207 Views)