var timestamptz_send = function(buf, value) { // postgres origin of time is 01/01/2000 var ts = value.getTime() - 946684800000; ts = 1000 * ts; // add unknown usecs var tbuf = new Buffer(8); int64.Int64BE(tbuf, 0, ts); buf.put(tbuf); }
var timestamptz_recv = function(buf) { var ts = int64.Int64BE(buf); ts = ts / 1000; ts = ts + 946684800000; return new Date(ts); }
Writer.prototype.writeInt64 = function(i){ var b = Int64(i).toBuffer(); this.write(b); return this; };