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 7
7
8
8
import Foundation
9
9
10
- let DISCORD_EPOCH = 1420070400000
11
-
12
10
public extension Snowflake {
11
+ static let DISCORD_EPOCH = 1420070400000
12
+
13
13
/// Decodes this Snowflake into a Date
14
14
func decodeToDate( ) -> Date ? {
15
15
guard let intSnowflake = Int ( self ) else { return nil }
16
- let millisTimestamp = ( intSnowflake >> 22 ) + DISCORD_EPOCH
16
+ let millisTimestamp = ( intSnowflake >> 22 ) + Self . DISCORD_EPOCH
17
17
return Date ( timeIntervalSince1970: Double ( millisTimestamp) / 1000.0 )
18
18
}
19
19
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public typealias Snowflake = String
11
11
12
12
extension Snowflake {
13
13
init ( timestamp: Date = . init( ) ) {
14
- let epoch = Int ( timestamp. timeIntervalSince1970*1000) - DISCORD_EPOCH
14
+ let epoch = Int ( timestamp. timeIntervalSince1970*1000) - Self . DISCORD_EPOCH
15
15
self . init ( epoch << 22 )
16
16
}
17
17
}
You can’t perform that action at this time.
0 commit comments