I have a Swift 2.2 (open source, non-xcode) project that I'm trying to get working. For my varchar columns everything is working fine. However, I'm trying to figure out timestamp.
The driver seems to return a integer in bytes. For this timestamp
2016-01-24 15:36:27.223667
I get back a byte array of
[0, 1, 205, 134, 65, 17, 249, 235]
I've tried converting this to a UInt64, which I can do via the ByteSwap.typeFromByteArray function. I'm not sure if this is the right approach, tho. I'm assuming that the byte array represents a 64-bit number, but I'm not sure which. For instance, the UInt64 representation of the byte array is 17003640841246146816, Int64 representation is -1443103232463404800 (I definitely don't think it's Int64).
Further reading of the postgres docs state that all timestamps are 8-byte Julian dates.
So, my first issue is trying to figure out what data type the byte array is returning back and then second will be getting the Julian date figured out.
Any thoughts on the first? Thanks.
I have a Swift 2.2 (open source, non-xcode) project that I'm trying to get working. For my varchar columns everything is working fine. However, I'm trying to figure out timestamp.
The driver seems to return a integer in bytes. For this timestamp
2016-01-24 15:36:27.223667I get back a byte array of
[0, 1, 205, 134, 65, 17, 249, 235]I've tried converting this to a
UInt64, which I can do via theByteSwap.typeFromByteArrayfunction. I'm not sure if this is the right approach, tho. I'm assuming that the byte array represents a 64-bit number, but I'm not sure which. For instance, theUInt64representation of the byte array is17003640841246146816,Int64representation is-1443103232463404800(I definitely don't think it's Int64).Further reading of the postgres docs state that all timestamps are 8-byte Julian dates.
So, my first issue is trying to figure out what data type the byte array is returning back and then second will be getting the Julian date figured out.
Any thoughts on the first? Thanks.