Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get time more precise!

Status
Not open for further replies.

skyplayer

Programmer
May 28, 2002
13
HK
How can I get current time within a second precision
e.g. 10:59:19:001
 
There are three current date/time functions that I know of in VB.

Date - gives the date part of the current system time
Time - gives the time part of the current system time
Now - gives both the date and time part of the system time

The VB Date data type (not the date function) only has one second precision. Hence the Now and Time functions will only give you the nearest second.
 
Your example actually seems to indicate a requirement for millisecond accuracy. Is this correct?
 
hello there

a better solution is to use "GetSystemTime()" Windows API function. it gives u the most precise time.

refer to MSDN library for the documentation of this API func

ComputerJin
 
GetSystemTime is still not accurate to the millisecond level, hence my question about whether this was really the accuracy required.

As an aside, I note that one of the design goals of Longhorn (next version of Windows) is to provide timers with nanosecond accuracy...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top