GetLocalTime和GetSystemTime之间的区别? [英] Difference between GetLocalTime and GetSystemTime ?

查看:171
本文介绍了GetLocalTime和GetSystemTime之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在代码中使用了 GetLocalTime 来检查垂直函数需要花费多少时间来进行处理.

为此, GetLocalTime GetSystemTime 是最佳选择?

他们是一样的吗?如果我要衡量代码的性能,应该使用哪一个.


预先感谢.

Hi,

I am using GetLocalTime in my code to check how much time the perticular function is taking for processing.

For this purpose which one is the best choice GetLocalTime or GetSystemTime ?

Are they same ? which one should be used if i am measuring the performance of the code.


Thanks in advance.

推荐答案

[回答后续问题]

由于这是C ++/CLI,因此可以使用.NET库.对于性能测量,请使用类System.Diagnostics.Stopwatch,因为它具有更好的精度(在大多数系统上为亚微秒).您可以通过调用静态属性System.Diagnostics.Stopwatch.IsHighResolutionSystem.Diagnostics.Stopwatch.Frequency来查询高分辨率操作是否可访问以及实现的频率.请参阅 http://msdn.microsoft.com/en-us/library/system.diagnostics .stopwatch.aspx [ ^ ].

—SA
[Answering a follow-up question]

As this is C++/CLI, you can use .NET libraries. For performance measuring, use the class System.Diagnostics.Stopwatch as it has much better accuracy (sub-microsecond on most systems). You can inquire if the high resolution operation is accessible and the implemented frequency by calling static properties System.Diagnostics.Stopwatch.IsHighResolution and System.Diagnostics.Stopwatch.Frequency. See http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx[^].

—SA


GetLocalTime为您提供基于当前时区的时间.
GetSystemTime是系统时间,与时区无关.
GetLocalTime gives you time based on current timezone.
GetSystemTime is the system time and has nothing to do with timezone.


这篇关于GetLocalTime和GetSystemTime之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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