namespace Application.Service.Pub; public class TimeExtend { public static long GetTimeStampSeconds { get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); } public static long GetTimeStampMilliseconds { get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds); } public static long GetTimeStampBySeconds(DateTime time) { return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); } public static long GetTimeStampByMilliseconds(DateTime time) { return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds); } }