LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Howto set system clock with milliseconds precision

Solved!
Go to solution

Hi! I need to set the system clock with milliseconds precision. The Labwindows CVI SetSystemTime function use only seconds precision. How to get around the problem?

Thanks in advice!

0 Kudos
Message 1 of 4
(4,773 Views)

Hi, why do you need such a functioanlity?

 

Are you trying to time an event's start/stop instants? I am not sure if Windows clock can be set to milliseconds.

 

I think a workaround can be found if you can clarify your needs. 

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 4
(4,769 Views)
Solution
Accepted by topic author dfantoni

I talked too early,

 

Actually I found that the SDK version of the  SetSytemTime function does accept milliseconds.

 

However, its usage is a little different.

You need to create an object of type SYSTEMTIME and set its members to the values you need.

Then, call the SetSystemTime function (of the WinSDK) to set the clock.

 

You need to add "windows.h" to the top of your include list.

(see SDK help, there is a sample code available there) 

Message Edited by ebalci on 01-04-2010 12:05 PM
S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 4
(4,767 Views)

I need to change the PC system clock with milliseconds precision to synchronize the time with an instruments connected via TCP/IP.

Thanks for the tips!

0 Kudos
Message 4 of 4
(4,763 Views)