using System; namespace DiscordPresence { public static class DiscordTime { /// /// Get the current time /// /// The current time epoch public static long TimeNow() { return (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds; } /// /// Add time to an epoch value /// /// Epoch value /// Seconds to add /// Minutes to add /// Hours to add /// [Obsolete("AddTime (ref) is deprecated. Use regular add time method instead.")] public static long AddTime(ref long time, int seconds, int minutes = 0, int hours = 0) { time += seconds; time += minutes * 60; time += hours * 3600; return 0; } public static long AddTime(long time = -1, int seconds = 0, int minutes = 0, int hours = 0) { if (time == -1) time = TimeNow(); time += seconds; time += minutes * 60; time += hours * 3600; return time; } public static long SubtractTime(long time = -1, int seconds = 0, int minutes = 0, int hours = 0) { if (time == -1) time = TimeNow(); time -= seconds; time -= minutes * 60; time -= hours * 3600; return time; } } }