Skip to content

Commit 79644f9

Browse files
committed
Update to chrono 0.3
Closes sfackler#232
1 parent 814c579 commit 79644f9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

postgres-shared/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ phf = "=0.7.21"
2222
postgres-protocol = "0.2"
2323

2424
bit-vec = { version = "0.4", optional = true }
25-
chrono = { version = "0.2.14", optional = true }
25+
chrono = { version = "0.3", optional = true }
2626
eui48 = { version = "0.1", optional = true }
2727
rustc-serialize = { version = "0.3", optional = true }
2828
serde_json = { version = ">= 0.6, < 0.10", optional = true }

postgres-shared/src/types/chrono.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl ToSql for NaiveDateTime {
2929
w: &mut Vec<u8>,
3030
_: &SessionInfo)
3131
-> Result<IsNull, Box<Error + Sync + Send>> {
32-
let time = match (*self - base()).num_microseconds() {
32+
let time = match self.signed_duration_since(base()).num_microseconds() {
3333
Some(time) => time,
3434
None => return Err("value too large to transmit".into()),
3535
};
@@ -134,7 +134,7 @@ impl ToSql for NaiveDate {
134134
w: &mut Vec<u8>,
135135
_: &SessionInfo)
136136
-> Result<IsNull, Box<Error + Sync + Send>> {
137-
let jd = (*self - base().date()).num_days();
137+
let jd = self.signed_duration_since(base().date()).num_days();
138138
if jd > i32::max_value() as i64 || jd < i32::min_value() as i64 {
139139
return Err("value too large to transmit".into());
140140
}
@@ -165,7 +165,7 @@ impl ToSql for NaiveTime {
165165
w: &mut Vec<u8>,
166166
_: &SessionInfo)
167167
-> Result<IsNull, Box<Error + Sync + Send>> {
168-
let delta = *self - NaiveTime::from_hms(0, 0, 0);
168+
let delta = self.signed_duration_since(NaiveTime::from_hms(0, 0, 0));
169169
let time = match delta.num_microseconds() {
170170
Some(time) => time,
171171
None => return Err("value too large to transmit".into()),

postgres/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ postgres-shared = { version = "0.1", path = "../postgres-shared" }
5555
url = "1.0"
5656

5757
bit-vec = "0.4"
58-
chrono = "0.2.14"
58+
chrono = "0.3"
5959
eui48 = "0.1"
6060
rustc-serialize = "0.3"
6161
serde_json = ">= 0.6, < 0.10"

0 commit comments

Comments
 (0)