Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Time Stamping logged data in VB at msec resolution

Hi all. I am acquiring data from 8 channels using a PCI-6033E board and a program which i developed with visual basic (measurement studio-component works) at a rate of 20 samples/second. I am saving the logged data to text files. I need to time stamp the logged samples at millisecond resolution and time stamp to the text files, opposite to the data. The time of the PC that i am using is synchronised to an accurate GPS clock. The problem is that "Time" function of Visual Basic returns a time stamp of 1 second resolution. Any help from somebody?
Thanks.
0 Kudos
Message 1 of 3
(3,174 Views)
You could use a Win32 function such as GetSystemTime or GetLocalTime. The Declare statements that you would need look like this:

Private 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
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)


You could build your timestamp from the returned SYSTEMTIME or you could use GetTimeFormat to format it for you.

- Elton
0 Kudos
Message 2 of 3
(3,174 Views)
Elton,

thank you. It worked very nicely.

-sstavrin
0 Kudos
Message 3 of 3
(3,174 Views)