如何统计程序的运行时间精确到毫秒级

解决方案 »

  1.   

    Option ExplicitDeclare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)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 IntegerEnd Type
      

  2.   

    Public Function MsDateFormat() As String
        Dim lpSystem As SYSTEMTIME
        GetSystemTime lpSystem
        Dim YMDHS As String
        Dim Ms As String
        
        YMDHS = lpSystem.wYear & "/" & lpSystem.wMonth & "/" & lpSystem.wDay & " " & lpSystem.wHour & ":" & lpSystem.wMinute & ":" & lpSystem.wSecond
        Ms = Format(lpSystem.wMilliseconds, "000")
        
        MsDateFormat = Format(YMDHS, "YYYY/MM/DD HH:MM:SS") & "." & MsEnd Function
      

  3.   

    调用MsDateFormat函数就可以得毫秒级时间
    怎么得到运行时间大概就不用说了吧