V0.6.2 Arroyo Toad

Fixed timeconversion to support unixepoch timestamp
This commit is contained in:
Christian Risi
2024-12-06 19:08:29 +00:00
parent ad4fd555f1
commit f3bc5f32e2
6 changed files with 21 additions and 3 deletions

View File

@@ -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]
}
}

View File

@@ -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)
}
}