LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Q: How to get local time in milliseconds?

Hi,

As we know, Labview a G function which can get local date/time in
seconds. Is there any way to get local date/time in milliseconds? Or it
also helps if you know there is any similiar function in C/C++.

Thanks!

--
G. Chen
Ph.D. Candidate
Ohio Univeristy, Athens, OH
Nothing can dim the light which shines from within.


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 1 of 2
(4,493 Views)
> As we know, Labview a G function which can get local date/time in
> seconds. Is there any way to get local date/time in milliseconds? Or it
> also helps if you know there is any similiar function in C/C++.
>

The local time function returns a double precision number.
Depending on the platform you are using, the number returned
may have a subsecond amount. This means that you subtract
and multiply by 1000 to get ms. The platform that returns
this is Win32, and its resolution is 55ms. Other platforms
will always return 0.

It is also sort of possible to synch the ms function with
the local time function, but this is not very accurate.
It involves watching the local time function in a loop
until it changes, and also sample the ms clock to synchronize
the two clocks.
From that point on, you can use the ms
function exclusively, and do the math to get back to local
time. The problem with this is that the fast clock rolls over
about every 40 days, the clock may have some drift with the
local clock, and then there is daylight saving time and time
zone math, which is always surprisingly complex.

Greg McKaskle
0 Kudos
Message 2 of 2
(4,493 Views)