Files
Fishing2Server/Fantasy/Fantays.Console/Runtime/Core/Helper/WinPeriod.cs
2025-06-30 10:51:37 +08:00

24 lines
692 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Runtime.InteropServices;
namespace Fantasy.Helper
{
/// <summary>
/// 精度设置
/// </summary>
public static partial class WinPeriod
{
// 一般默认的精度不止1毫秒不同操作系统有所不同需要调用timeBeginPeriod与timeEndPeriod来设置精度
[DllImport("winmm")]
private static extern void timeBeginPeriod(int t);
/// <summary>
/// 针对Windows平台设置精度
/// </summary>
public static void Initialize()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
timeBeginPeriod(1);
}
}
}
}