V0.6.2 Arroyo Toad
Fixed timeconversion to support unixepoch timestamp
This commit is contained in:
@@ -29,4 +29,8 @@ public extension Data {
|
||||
var timestamp: Date {
|
||||
return self.withUnsafeBytes{ $0.bindMemory(to: Date.self) }[0]
|
||||
}
|
||||
|
||||
var double: Double {
|
||||
return self.withUnsafeBytes{ $0.bindMemory(to: Double.self) }[0]
|
||||
}
|
||||
}
|
||||
@@ -41,3 +41,10 @@ extension Date: DataCompatibleP {
|
||||
return Data(bytes: &obj, count: MemoryLayout<Self>.stride)
|
||||
}
|
||||
}
|
||||
|
||||
extension Double: DataCompatibleP {
|
||||
public var data: Data {
|
||||
var obj = self
|
||||
return Data(bytes: &obj, count: MemoryLayout<Self>.stride)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user