精确到达时间,以毫秒为单位 [英] getting elapsed time with accuracy in milliseconds

查看:117
本文介绍了精确到达时间,以毫秒为单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要求找到两个功能之间经过的时间

来电。我需要找到精确到1毫秒的时间。

我现在面临的问题是,我正在使用''时间()''

函数调用的目的,无论我多少次调用

我的程序中的函数,我得到相同的输出!!!

为了更好的清晰度考虑下面的代码片段。

I''ve a requirement to find the elapsed time between two function
calls. I need to find the time elapsed accurate to 1 millisecond.
The problem I''m facing right now is that, I''m using the ''time()''
function call for the purpose and regardless of how many time I invoke
the function within my program, I get the same output!!!
For better clarity consider the code snippet below.

展开 | 选择 | Wrap | 行号

推荐答案

2007年3月9日星期五03: 09:30 -0600,Spitfire< ti ********** @ gmail.com>

写道:
On Fri, 09 Mar 2007 03:09:30 -0600, Spitfire <ti**********@gmail.com>
wrote:

我要求找到两个函数
调用之间经过的时间。我需要找到精确到1毫秒的时间。

I''ve a requirement to find the elapsed time between two function
calls. I need to find the time elapsed accurate to 1 millisecond.

展开 | 选择 | Wrap | 行号


Stefan Pendl写道:
Stefan Pendl wrote:

因为time()只返回秒。


你必须使用clock(),它使用时钟滴答,你可以

转换为毫秒。


---

Stefan Pendl
Because time() will only return seconds.

You will have to use clock(), which uses clock ticks, which you can
convert to milliseconds.

---
Stefan Pendl



感谢你的准备时间()


而且,关于clock(),也得到了与tim相同的价值e()

每次我运行它!!!

-

_ _ _] {5pitph!r3} [_ _ _

__________________________________________________

a ??我很聪明,知道我很笨。啊??

- Richard P Feynman

Thanks for the heads up on time()

And, regarding clock(), also gets me the same value like that of time()
every time I run it!!!
--
_ _ _]{5pitph!r3}[_ _ _
__________________________________________________
a??I''m smart enough to know that I''m dumb.a??
- Richard P Feynman


3月9日凌晨1点09分,Spitfire< timid.gen ... @ gmail.comwrote:
On Mar 9, 1:09 am, Spitfire <timid.gen...@gmail.comwrote:

我要求找到两个函数之间经过的时间

调用。我需要找到精确到1毫秒的时间。

我现在面临的问题是,我正在使用''时间()''

函数调用的目的,无论我多少次调用

我的程序中的函数,我得到相同的输出!!!

为了更好的清晰度考虑下面的代码片段。

I''ve a requirement to find the elapsed time between two function
calls. I need to find the time elapsed accurate to 1 millisecond.
The problem I''m facing right now is that, I''m using the ''time()''
function call for the purpose and regardless of how many time I invoke
the function within my program, I get the same output!!!
For better clarity consider the code snippet below.

展开 | 选择 | Wrap | 行号


这篇关于精确到达时间,以毫秒为单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆