1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-06-10 04:53:54 +00:00

Use new i64::to_be_bytes and remove byteorder dep

(https://doc.rust-lang.org/stable/std/primitive.i64.html#method.to_be_bytes)
This commit is contained in:
Daniel García 2019-01-16 22:14:17 +01:00
parent 1ce2587330
commit e0aec8d373
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
4 changed files with 38 additions and 50 deletions

View file

@ -90,11 +90,8 @@ fn serialize_date(date: NaiveDateTime) -> Value {
let seconds: i64 = date.timestamp();
let nanos: i64 = date.timestamp_subsec_nanos() as i64;
let timestamp = nanos << 34 | seconds;
use byteorder::{BigEndian, WriteBytesExt};
let mut bs = [0u8; 8];
bs.as_mut().write_i64::<BigEndian>(timestamp).expect("Unable to write");
let bs = timestamp.to_be_bytes();
// -1 is Timestamp
// https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type