File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 77
88import Foundation
99
10- let DISCORD_EPOCH = 1420070400000
11-
1210public extension Snowflake {
11+ static let DISCORD_EPOCH = 1420070400000
12+
1313 /// Decodes this Snowflake into a Date
1414 func decodeToDate( ) -> Date ? {
1515 guard let intSnowflake = Int ( self ) else { return nil }
16- let millisTimestamp = ( intSnowflake >> 22 ) + DISCORD_EPOCH
16+ let millisTimestamp = ( intSnowflake >> 22 ) + Self . DISCORD_EPOCH
1717 return Date ( timeIntervalSince1970: Double ( millisTimestamp) / 1000.0 )
1818 }
1919}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public typealias Snowflake = String
1111
1212extension Snowflake {
1313 init ( timestamp: Date = . init( ) ) {
14- let epoch = Int ( timestamp. timeIntervalSince1970*1000) - DISCORD_EPOCH
14+ let epoch = Int ( timestamp. timeIntervalSince1970*1000) - Self . DISCORD_EPOCH
1515 self . init ( epoch << 22 )
1616 }
1717}
You can’t perform that action at this time.
0 commit comments