以微秒为单位获取当前时间戳 [英] getting current timestamp in micro secs

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

问题描述



我想以微秒精度找到当前时间戳。


要求是,

我的函数在无限循环中执行。

我测量一个值并检查计算出的值是否符合我的预期

9忘记所有这些东西。

我想在每次事件发生时打印时间戳。


所以我的要求是打印当前的时间戳。


so我可以计算出事件发生后的平均时间(以微秒为单位)......


我希望我能明白我的要求。 />

任何人都可以帮我解决这个问题。

我搜索了很多讨论但是找不到满意的答案。


提前感谢

Hi,
I want to find the current time stamp in micro sec precision.

The requirement is,
my function is executed in an infinite loop.
I measure a value and check if the value computed is what i expected
9forget all this stuff).
I want to print the time stamp every time that event occurs.

So my requirement is printing the current timestamps.

so I can calculate the average time (in micro secs) after which such
an event occur...

I hope I made my requirement clear.

Can anybody pls help me with this problem.
I searched many discussion but couldn''t find satisfactory answer.

thanks in advance

推荐答案

Ashit Vora< a。****** @ gmail.comwrote:
Ashit Vora <a.******@gmail.comwrote:



我想找到微秒级的当前时间戳sion。


要求是,

我的函数在无限循环中执行。

我测量一个值并检查是否计算出来的值是我的预期

9忘记所有这些东西。

我想在每次事件发生时打印时间戳。


所以我的要求是打印当前的时间戳。


所以我可以计算平均时间(以微秒为单位)之后这样的事件

一个事件发生...


我希望我的要求清楚。


有人可以帮我解决这个问题。

我搜索了很多讨论,但找不到满意的答案。


提前谢谢
Hi,
I want to find the current time stamp in micro sec precision.

The requirement is,
my function is executed in an infinite loop.
I measure a value and check if the value computed is what i expected
9forget all this stuff).
I want to print the time stamp every time that event occurs.

So my requirement is printing the current timestamps.

so I can calculate the average time (in micro secs) after which such
an event occur...

I hope I made my requirement clear.

Can anybody pls help me with this problem.
I searched many discussion but couldn''t find satisfactory answer.

thanks in advance



没有这样做的便携方式,所以你必须使用一些

系统特定的方法来做它。

如果你使用的是类Unix系统,那么你将可能有

gettimeofday()可用。但请注意,即使它确实返回一个值(微秒),它会打开,大多数系统,不准确超过10毫秒

左右。


如果你真的需要微秒级的精度,那么无论你找到什么方法,你的特定系统都是非常具体的,而且根本不需要.b $ b便携式。


-

<在这里插入你最喜欢的报价。>

Erik Trulsson
er******@student.uu.se

9月18日,07:35,Ashit Vora< akv .. @ gmail.comwrote:
On 18 Sep, 07:35, Ashit Vora <a.k.v...@gmail.comwrote:

我想在微信中找到当前的时间戳秒精度。


要求是,

我的函数在无限循环中执行。

我测量一个值并检查如果计算出的值是我的预期

9忘记所有这些东西。)

我想每次打印时间戳发生了。


所以我的要求是打印当前的时间戳。


所以我可以计算平均时间(以微秒为单位)之后这样的事件发生了......


我希望我明白我的要求。


任何人都可以请帮助我解决这个问题。

我搜索了很多讨论但是找不到满意的答案。


提前感谢
I want to find the current time stamp in micro sec precision.

The requirement is,
my function is executed in an infinite loop.
I measure a value and check if the value computed is what i expected
9forget all this stuff).
I want to print the time stamp every time that event occurs.

So my requirement is printing the current timestamps.

so I can calculate the average time (in micro secs) after which such
an event occur...

I hope I made my requirement clear.

Can anybody pls help me with this problem.
I searched many discussion but couldn''t find satisfactory answer.

thanks in advance



你已经被告知了答案。

你为什么再次发帖?


-

Nick Keighley

you''ve already been told the answer to this.
Why did you post again?

--
Nick Keighley


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

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