各位好,小弟新人
想在同一个程序中获取不同事件处理时的具体时间,精确到毫秒的,但我下面所编写的代码所获得的是同一个时间,没有实在意义。所以请大家帮帮忙,看用什么办法获得具体的不同的时间。谢谢。Many thanks。程序块如下:
Dim i, fn, fm, p
p = "You are the sun."
fn = FreeFile
fm = "d:\vb\test2.txt"
Open fm For Append As #fn
For i = 1 To 50
Print #fn, Format(Now, "ddd,yyyy-m-d hh:mm:ss:sss"), p
Next i
Close
Dim k, ff, fk, q
q = "You are the moon."
ff = FreeFile
fk = "d:\vb\test2.txt"
Open fk For Append As #ff
For k = 1 To 50
Print #ff, Format(Now, "ddd,yyyy-m-d hh:mm:ss:sss"), q
Next k
Close部分output如下:
Thu,2008-4-17 17:18:11:1111 You are the sun.
Thu,2008-4-17 17:18:11:1111 You are the sun.
Thu,2008-4-17 17:18:11:1111 You are the sun.
Thu,2008-4-17 17:18:11:1111 You are the sun.
Thu,2008-4-17 17:18:11:1111 You are the moon.
Thu,2008-4-17 17:18:11:1111 You are the moon.
Thu,2008-4-17 17:18:11:1111 You are the moon.
Thu,2008-4-17 17:18:11:1111 You are the moon.
Thu,2008-4-17 17:18:11:1111 You are the moon.请问各位,如果才能获得处理过程中的真实的时间(精确到毫秒)?谢谢

解决方案 »

  1.   

    你清楚for 空语句执行一次所耗费的时间吗?
      

  2.   

    to forbearORfolie :
    请注意,我上面有两个程序块,我所想要的不同主要是指第一个和第二个的不同时间,比如上面的print You are the sun. 和print You are the moon. 的不同时间,而不是一个for里面的两条print时间。
    或者你所要表达的是其他意思? 请指点指点呀,小弟愚钝。谢谢。
      

  3.   

    中间加一个小的程序段,从1加到1000000,再print
      

  4.   

    还是用高精度计时器吧:
    http://blog.csdn.net/chenjl1031/archive/2008/01/09/2032579.aspx