CTT/Unity/Assets/Model/Core/Helper/TimeHelper.cs

55 lines
1.2 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using System;
using System.Globalization;
namespace ET
{
public static class TimeHelper
{
public const long OneDay = 86400000;
public const long Hour = 3600000;
public const long Minute = 60000;
/// <summary>
/// 客户端时间
/// </summary>
/// <returns></returns>
public static long ClientNow()
{
return Game.TimeInfo.FrameTime;
}
public static long ClientNowSeconds()
{
return ClientNow() / 1000;
}
public static DateTime DateTimeNow()
{
2021-05-21 22:50:06 +08:00
return DateTime.UtcNow;
2021-04-08 20:09:59 +08:00
}
public static long ServerNow()
{
return Game.TimeInfo.ServerNow();
}
public static long ClientFrameTime()
{
return Game.TimeInfo.ClientFrameTime();
}
public static long ServerFrameTime()
{
return Game.TimeInfo.ServerFrameTime();
}
2021-05-21 22:50:06 +08:00
public static int GetTodayDay(DateTime time)
{
return Game.TimeInfo.GetTodayDay(time);
}
public static int GetTodayDay()
{
return Game.TimeInfo.GetTodayDay(DateTimeNow());
}
2021-04-08 20:09:59 +08:00
}
}