Fix TimestampTz type to i64 to be compatbile with Postgres

This commit is contained in:
Konstantin Knizhnik
2021-07-13 14:33:20 +03:00
parent 386403dcd1
commit f6705b7a7d
2 changed files with 3 additions and 3 deletions

View File

@@ -428,7 +428,7 @@ impl XlXactParsedRecord {
pub fn decode(buf: &mut Bytes, mut xid: TransactionId, xl_info: u8) -> XlXactParsedRecord {
let info = xl_info & pg_constants::XLOG_XACT_OPMASK;
// The record starts with time of commit/abort
let xact_time = buf.get_u64_le();
let xact_time = buf.get_i64_le();
let xinfo;
if xl_info & pg_constants::XLOG_XACT_HAS_INFO != 0 {
xinfo = buf.get_u32_le();

View File

@@ -96,8 +96,8 @@ pub fn get_current_timestamp() -> TimestampTz {
match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
Ok(n) => {
((n.as_secs() - ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY))
* USECS_PER_SEC
+ n.subsec_micros() as u64) as i64
* USECS_PER_SEC
+ n.subsec_micros() as u64) as i64
}
Err(_) => panic!("SystemTime before UNIX EPOCH!"),
}