parent
814c5797c5
commit
79644f9279
@ -22,7 +22,7 @@ phf = "=0.7.21"
|
||||
postgres-protocol = "0.2"
|
||||
|
||||
bit-vec = { version = "0.4", optional = true }
|
||||
chrono = { version = "0.2.14", optional = true }
|
||||
chrono = { version = "0.3", optional = true }
|
||||
eui48 = { version = "0.1", optional = true }
|
||||
rustc-serialize = { version = "0.3", optional = true }
|
||||
serde_json = { version = ">= 0.6, < 0.10", optional = true }
|
||||
|
@ -29,7 +29,7 @@ impl ToSql for NaiveDateTime {
|
||||
w: &mut Vec<u8>,
|
||||
_: &SessionInfo)
|
||||
-> Result<IsNull, Box<Error + Sync + Send>> {
|
||||
let time = match (*self - base()).num_microseconds() {
|
||||
let time = match self.signed_duration_since(base()).num_microseconds() {
|
||||
Some(time) => time,
|
||||
None => return Err("value too large to transmit".into()),
|
||||
};
|
||||
@ -134,7 +134,7 @@ impl ToSql for NaiveDate {
|
||||
w: &mut Vec<u8>,
|
||||
_: &SessionInfo)
|
||||
-> Result<IsNull, Box<Error + Sync + Send>> {
|
||||
let jd = (*self - base().date()).num_days();
|
||||
let jd = self.signed_duration_since(base().date()).num_days();
|
||||
if jd > i32::max_value() as i64 || jd < i32::min_value() as i64 {
|
||||
return Err("value too large to transmit".into());
|
||||
}
|
||||
@ -165,7 +165,7 @@ impl ToSql for NaiveTime {
|
||||
w: &mut Vec<u8>,
|
||||
_: &SessionInfo)
|
||||
-> Result<IsNull, Box<Error + Sync + Send>> {
|
||||
let delta = *self - NaiveTime::from_hms(0, 0, 0);
|
||||
let delta = self.signed_duration_since(NaiveTime::from_hms(0, 0, 0));
|
||||
let time = match delta.num_microseconds() {
|
||||
Some(time) => time,
|
||||
None => return Err("value too large to transmit".into()),
|
||||
|
@ -55,7 +55,7 @@ postgres-shared = { version = "0.1", path = "../postgres-shared" }
|
||||
url = "1.0"
|
||||
|
||||
bit-vec = "0.4"
|
||||
chrono = "0.2.14"
|
||||
chrono = "0.3"
|
||||
eui48 = "0.1"
|
||||
rustc-serialize = "0.3"
|
||||
serde_json = ">= 0.6, < 0.10"
|
||||
|
Loading…
Reference in New Issue
Block a user