Files
TEngine/Assets/GameScripts/DotNet/Core/Helper/WinPeriod.cs
ALEXTANG 336d4b2eb9 [+] 接入ET8服务端
[+] 接入ET8服务端
2023-07-13 12:23:48 +08:00

21 lines
605 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 ET
{
public static class WinPeriod
{
// 一般默认的精度不止1毫秒不同操作系统有所不同需要调用timeBeginPeriod与timeEndPeriod来设置精度
[DllImport("winmm")]
private static extern void timeBeginPeriod(int t);
//[DllImport("winmm")]
//static extern void timeEndPeriod(int t);
public static void Init()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
timeBeginPeriod(1);
}
}
}
}