using System; namespace Discord { /// /// Provides a series of helper methods for handling snowflake identifiers. /// public static class SnowflakeUtils { /// /// Resolves the time of which the snowflake is generated. /// /// The snowflake identifier to resolve. /// /// A representing the time for when the object is geenrated. /// public static DateTimeOffset FromSnowflake(ulong value) => DateTimeOffset.FromUnixTimeMilliseconds((long)((value >> 22) + 1420070400000UL)); /// /// Generates a pseudo-snowflake identifier with a . /// /// The time to be used in the new snowflake. /// /// A representing the newly generated snowflake identifier. /// public static ulong ToSnowflake(DateTimeOffset value) => ((ulong)value.ToUnixTimeMilliseconds() - 1420070400000UL) << 22; } }