|
24 | 24 | use std::fmt::{self, Display, Debug}; |
25 | 25 | use std::ops::{Deref, DerefMut}; |
26 | 26 |
|
27 | | -use chrono::{DateTime, Timelike, UTC}; |
| 27 | +use chrono::{DateTime, Timelike, Utc}; |
28 | 28 | use chrono::offset::TimeZone; |
29 | 29 | use serde_json::Value; |
30 | 30 | use hex::{FromHex, ToHex}; |
@@ -69,7 +69,7 @@ pub enum Bson { |
69 | 69 | /// [ObjectId](http://dochub.mongodb.org/core/objectids) |
70 | 70 | ObjectId(oid::ObjectId), |
71 | 71 | /// UTC datetime |
72 | | - UtcDatetime(DateTime<UTC>), |
| 72 | + UtcDatetime(DateTime<Utc>), |
73 | 73 | /// Symbol (Deprecated) |
74 | 74 | Symbol(String), |
75 | 75 | } |
@@ -258,8 +258,8 @@ impl From<oid::ObjectId> for Bson { |
258 | 258 | } |
259 | 259 | } |
260 | 260 |
|
261 | | -impl From<DateTime<UTC>> for Bson { |
262 | | - fn from(a: DateTime<UTC>) -> Bson { |
| 261 | +impl From<DateTime<Utc>> for Bson { |
| 262 | + fn from(a: DateTime<Utc>) -> Bson { |
263 | 263 | Bson::UtcDatetime(a) |
264 | 264 | } |
265 | 265 | } |
@@ -479,7 +479,7 @@ impl Bson { |
479 | 479 | } else if let Ok(long) = values |
480 | 480 | .get_document("$date") |
481 | 481 | .and_then(|inner| inner.get_i64("$numberLong")) { |
482 | | - return Bson::UtcDatetime(UTC.timestamp(long / 1000, |
| 482 | + return Bson::UtcDatetime(Utc.timestamp(long / 1000, |
483 | 483 | ((long % 1000) * 1000000) as u32)); |
484 | 484 | } else if let Ok(sym) = values.get_str("$symbol") { |
485 | 485 | return Bson::Symbol(sym.to_owned()); |
@@ -557,7 +557,7 @@ impl Bson { |
557 | 557 | } |
558 | 558 |
|
559 | 559 | /// If `Bson` is `UtcDateTime`, return its value. Returns `None` otherwise |
560 | | - pub fn as_utc_date_time(&self) -> Option<&DateTime<UTC>> { |
| 560 | + pub fn as_utc_date_time(&self) -> Option<&DateTime<Utc>> { |
561 | 561 | match *self { |
562 | 562 | Bson::UtcDatetime(ref v) => Some(v), |
563 | 563 | _ => None, |
@@ -605,30 +605,30 @@ impl Bson { |
605 | 605 | /// } |
606 | 606 | /// ``` |
607 | 607 | #[derive(Debug, Eq, PartialEq, Copy, Clone)] |
608 | | -pub struct UtcDateTime(pub DateTime<UTC>); |
| 608 | +pub struct UtcDateTime(pub DateTime<Utc>); |
609 | 609 |
|
610 | 610 | impl Deref for UtcDateTime { |
611 | | - type Target = DateTime<UTC>; |
| 611 | + type Target = DateTime<Utc>; |
612 | 612 |
|
613 | 613 | fn deref(&self) -> &Self::Target { |
614 | 614 | &self.0 |
615 | 615 | } |
616 | 616 | } |
617 | 617 |
|
618 | 618 | impl DerefMut for UtcDateTime { |
619 | | - fn deref_mut(&mut self) -> &mut DateTime<UTC> { |
| 619 | + fn deref_mut(&mut self) -> &mut DateTime<Utc> { |
620 | 620 | &mut self.0 |
621 | 621 | } |
622 | 622 | } |
623 | 623 |
|
624 | | -impl Into<DateTime<UTC>> for UtcDateTime { |
625 | | - fn into(self) -> DateTime<UTC> { |
| 624 | +impl Into<DateTime<Utc>> for UtcDateTime { |
| 625 | + fn into(self) -> DateTime<Utc> { |
626 | 626 | self.0 |
627 | 627 | } |
628 | 628 | } |
629 | 629 |
|
630 | | -impl From<DateTime<UTC>> for UtcDateTime { |
631 | | - fn from(x: DateTime<UTC>) -> Self { |
| 630 | +impl From<DateTime<Utc>> for UtcDateTime { |
| 631 | + fn from(x: DateTime<Utc>) -> Self { |
632 | 632 | UtcDateTime(x) |
633 | 633 | } |
634 | 634 | } |
0 commit comments