You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
774 B

1 month ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SogClient
{
public static class TimeUtils
{
private static DateTime m_dateTime1970_utc = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private static DateTime m_dateTime1970 = m_dateTime1970_utc.ToLocalTime();
/// <summary>
/// 毫秒
/// </summary>
/// <returns></returns>
public static long GetTime()
{
TimeSpan ts = DateTime.Now - m_dateTime1970;
long timeMs = (long)ts.TotalMilliseconds;
return timeMs;
}
public static long GetTimeSecond()
{
return GetTime() / 1000;
}
}
}