Private Type LARGE_INTEGER
lowpart As Long
highpart As Long
End Type
Private Declare Function QueryPerformanceCounter Lib "kernel32" _
(lpPerformanceCount As LARGE_INTEGER) As Long
Private Declare Function QueryPerformanceFrequency Lib "kernel32" _
(lpFrequency As LARGE_INTEGER) As Long
Dim starttime As LARGE_INTEGER, frequency As LARGE_INTEGER, nowtime As LARGE_INTEGER
Dim nowtime1 As LARGE_INTEGER
Dim nowtime2 As LARGE_INTEGER
Private Sub Command1_Click()
MsgBox timediff, 0, "needtime(2^0.5)-needtime(sqr(2))"
End Sub
Function timediff()
QueryPerformanceFrequency frequency
QueryPerformanceCounter starttime
a = Sqr(2)
QueryPerformanceCounter nowtime1
b = 2 ^ 0.5
QueryPerformanceCounter nowtime2
timediff = Format((nowtime2.lowpart - nowtime1.lowpart) / frequency.lowpart, "0.00000000000000") & "s"
End Function