C# 获取系统相关时间

来源:互联网 发布:淘宝新开店铺采集器 编辑:程序博客网 时间:2024/04/25 15:38

获取系统时钟频率

[DllImport("kernel32")]static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency);

获取系统时钟计数

 [DllImport("kernel32.dll ")] static extern bool QueryPerformanceCounter(ref long lpPerformanceCount);

获取精确时间

 [DllImport("kernel32.dll")]  //100ns 精度 public static extern void GetSystemTimeAsFileTime(out System.Runtime.InteropServices.ComTypes.FILETIME lpSystemTimeAsFileTime);long a = (((long)lpSystemTimeAsFileTime.dwHighDateTime) << 32) | ((uint)lpSystemTimeAsFileTime.dwLowDateTime);

其它相关参考:http://www.cnblogs.com/kex1n/p/3297607.html
http://www.cnblogs.com/sifenkesi/archive/2011/06/01/2065673.html

0 0