using System; namespace Snowlight { public static class UnixTimestamp { public static double GetCurrent() { TimeSpan ts = (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)); return ts.TotalSeconds; } public static DateTime GetDateTimeFromUnixTimestamp(double Timestamp) { DateTime DT = new DateTime(1970, 1, 1, 0, 0, 0, 0); DT = DT.AddSeconds(Timestamp); return DT; } } }