mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-03-31 02:39:06 +00:00
Switch from DateTime to DateTimeOffset
This commit is contained in:
@@ -5,10 +5,10 @@ namespace DiscordChatExporter.Core.Services.Internal
|
||||
{
|
||||
internal static class Extensions
|
||||
{
|
||||
public static string ToSnowflake(this DateTime dateTime)
|
||||
public static string ToSnowflake(this DateTimeOffset date)
|
||||
{
|
||||
const long epoch = 62135596800000;
|
||||
var unixTime = dateTime.ToUniversalTime().Ticks / TimeSpan.TicksPerMillisecond - epoch;
|
||||
var unixTime = date.ToUniversalTime().Ticks / TimeSpan.TicksPerMillisecond - epoch;
|
||||
var value = ((ulong) unixTime - 1420070400000UL) << 22;
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user