C#中的GetTickCount()等价物是什么? [英] What is the GetTickCount() equivalent in C#?

查看:217
本文介绍了C#中的GetTickCount()等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如标题所示,是否有人知道C / C ++中针对C#的GetTickCount()

函数的等价物?


该函数应该返回自计算机/设备启动以来已经过去的时间

以毫秒启动。


通过te waym感谢所有以前的帮助。将当前的C / C ++代码转换为新的C#实际上并不容易,因为它不仅仅是不同的b / b
语法。我很难将简单的几页C / C ++转换成

C#...有时候,我希望在C#中有一个简单的memcpy。

Hi,

As the title indicated, does anyone know the equivalent of GetTickCount()
function in C/C++ for C#?

The function is supposed to return time elapsed since the computer/device is
booted in milisecond.

By te waym thanks for all the previous help. It is really not easy to
convert current C/C++ codes into the new C# as it is more than different
syntax. I am having headache converting a simple few pages of C/C++ into
C#... At times, I would like to have a simple memcpy in C#.

推荐答案

简单。使用静态DateTime.Now的Ticks属性,如DateTime.Now.Ticks。
Easy. Use the Ticks property of the static DateTime.Now, as in DateTime.Now.Ticks.


如标题所示,有没有人知道相当于C / C ++ for C#中的GetTickCount()函数?

该函数应该返回自
计算机/设备以毫秒启动后经过的时间。

通过te waym感谢所有以前的帮助。将当前的C / C ++代码转换为新的C#实际上并不容易,因为它不仅仅是不同的语法。我很头疼将C / C ++的简单几页转换成C#...有时候,我希望在C#中有一个简单的memcpy。
Hi,

As the title indicated, does anyone know the equivalent of
GetTickCount() function in C/C++ for C#?

The function is supposed to return time elapsed since the
computer/device is booted in milisecond.

By te waym thanks for all the previous help. It is really not easy to
convert current C/C++ codes into the new C# as it is more than
different syntax. I am having headache converting a simple few pages
of C/C++ into C#... At times, I would like to have a simple memcpy in
C#.



您仍然可以使用p / invoke来使用它。


它是kernel32.dll的一部分。

EOS <无**** @ nospam.org>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
You should still be able to use it using p/invoke.

It is part of the kernel32.dll.

"EOS" <no****@nospam.org> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...


正如标题所示,有没有人知道C / C ++中针对C#的GetTickCount()
函数的等价物?

该函数应该返回已经过去的时间因为计算机/设备是在毫秒级启动的。

通过te waym感谢所有以前的帮助。将当前的C / C ++代码转换为新的C#实际上并不容易,因为它不仅仅是不同的语法。我很难将简单的几页C / C ++转换成C#...有时,我想在C#中有一个简单的memcpy。
Hi,

As the title indicated, does anyone know the equivalent of GetTickCount()
function in C/C++ for C#?

The function is supposed to return time elapsed since the computer/device
is booted in milisecond.

By te waym thanks for all the previous help. It is really not easy to
convert current C/C++ codes into the new C# as it is more than different
syntax. I am having headache converting a simple few pages of C/C++ into
C#... At times, I would like to have a simple memcpy in C#.



>如标题所示,有没有人知道C / C ++中C#C ++的GetTickCount()
>As the title indicated, does anyone know the equivalent of GetTickCount()
函数的等价物?


System.Environment.TickCount


该函数应该返回自计算机/设备以毫秒启动以来经过的时间。
function in C/C++ for C#?
System.Environment.TickCount

The function is supposed to return time elapsed since the computer/device is
booted in milisecond.




然后以上情况不好,因为它会在~50天后回转。

考虑检查系统运行时性能计数器。

Mattias


-

Mattias Sj?gren [C#MVP] mattias @ mvps.org
< a rel =nofollowhref =http://www.msjogren.net/dotnet/target =_ blank> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com

请回复到新闻组。



Then the above is no good since it will wrap around after ~50 days.
Consider checking the System Up Time performance counter instead.
Mattias

--
Mattias Sj?gren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


这篇关于C#中的GetTickCount()等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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