Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: The-FooL on April 25, 2004, 01:51 PM

Title: Milliseconds
Post by: The-FooL on April 25, 2004, 01:51 PM
I seem to be missing something.  How can I get the current milliseconds in VB?

I want to do something like Format(Time, "HH:MM:SS") or its equivalent.
Title: Re:Milliseconds
Post by: Spht on April 25, 2004, 02:01 PM
Quote from: The-FooL on April 25, 2004, 01:51 PM
I seem to be missing something.  How can I get the current milliseconds in VB?

I want to do something like Format(Time, "HH:MM:SS") or its equivalent.

Call GetLocalTime() to get the current system time. It can be called like this:

Dim lpSystemTime As SYSTEMTIME
GetLocalTime lpSystemTime


SYSTEMTIME contains the system's year, month, day, hour, etcetera. lpSystemTime.wMilliseconds will contain the system's milliseconds in time.

If you don't have API viewer:

Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)

Public 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
Title: Re:Milliseconds
Post by: The-FooL on April 25, 2004, 08:08 PM
Thanks alot!