using System; namespace WS { ///<summary>时间处理帮助类</summary> public static class TimeHelper { private static readonly long epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks; public static readonly DateTime epochTime = new DateTime(1970, 1, 1, 0, 0, 0); /// <summary>时间戳 (毫秒)</summary> public static long ClientNow() { return (DateTime.UtcNow.Ticks - epoch) / 10000; } /// <summary>时间戳 (秒)</summary> public static long ClientNowSeconds() { return (DateTime.UtcNow.Ticks - epoch) / 10000000; } public static long Now() { return ClientNow(); } } }