/// <summary>
/// 将Unix时间戳转换为时间
/// </summary>
/// <param name="timeStamp"></param>
/// <returns></returns>
public static DateTime GetDateTime(long timeStamp)
{
DateTime startDt = TimeZoneInfo.ConvertTime(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), TimeZoneInfo.Local);
long lTime = timeStamp * 10000;
TimeSpan toNow = new TimeSpan(lTime);
return startDt.Add(toNow);
}

/// <summary>
/// 将时间转换为Unix时间戳
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static long GetUnix(DateTime time)
{
DateTime startDt = TimeZoneInfo.ConvertTime(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), TimeZoneInfo.Local);
return (long)(time - startDt).TotalMilliseconds;
}