1
1
extern crate chrono;
2
2
3
3
use postgres_protocol:: types;
4
- use self :: chrono:: { Duration , NaiveDate , NaiveTime , NaiveDateTime , DateTime , UTC , Local ,
4
+ use self :: chrono:: { Duration , NaiveDate , NaiveTime , NaiveDateTime , DateTime , Utc , Local ,
5
5
FixedOffset } ;
6
6
use std:: error:: Error ;
7
7
@@ -39,18 +39,18 @@ impl ToSql for NaiveDateTime {
39
39
to_sql_checked ! ( ) ;
40
40
}
41
41
42
- impl FromSql for DateTime < UTC > {
42
+ impl FromSql for DateTime < Utc > {
43
43
fn from_sql ( type_ : & Type ,
44
44
raw : & [ u8 ] )
45
- -> Result < DateTime < UTC > , Box < Error + Sync + Send > > {
45
+ -> Result < DateTime < Utc > , Box < Error + Sync + Send > > {
46
46
let naive = NaiveDateTime :: from_sql ( type_, raw) ?;
47
- Ok ( DateTime :: from_utc ( naive, UTC ) )
47
+ Ok ( DateTime :: from_utc ( naive, Utc ) )
48
48
}
49
49
50
50
accepts ! ( Type :: Timestamptz ) ;
51
51
}
52
52
53
- impl ToSql for DateTime < UTC > {
53
+ impl ToSql for DateTime < Utc > {
54
54
fn to_sql ( & self ,
55
55
type_ : & Type ,
56
56
w : & mut Vec < u8 > )
@@ -66,7 +66,7 @@ impl FromSql for DateTime<Local> {
66
66
fn from_sql ( type_ : & Type ,
67
67
raw : & [ u8 ] )
68
68
-> Result < DateTime < Local > , Box < Error + Sync + Send > > {
69
- let utc = DateTime :: < UTC > :: from_sql ( type_, raw) ?;
69
+ let utc = DateTime :: < Utc > :: from_sql ( type_, raw) ?;
70
70
Ok ( utc. with_timezone ( & Local ) )
71
71
}
72
72
@@ -78,7 +78,7 @@ impl ToSql for DateTime<Local> {
78
78
type_ : & Type ,
79
79
mut w : & mut Vec < u8 > )
80
80
-> Result < IsNull , Box < Error + Sync + Send > > {
81
- self . with_timezone ( & UTC ) . to_sql ( type_, w)
81
+ self . with_timezone ( & Utc ) . to_sql ( type_, w)
82
82
}
83
83
84
84
accepts ! ( Type :: Timestamptz ) ;
@@ -89,7 +89,7 @@ impl FromSql for DateTime<FixedOffset> {
89
89
fn from_sql ( type_ : & Type ,
90
90
raw : & [ u8 ] )
91
91
-> Result < DateTime < FixedOffset > , Box < Error + Sync + Send > > {
92
- let utc = DateTime :: < UTC > :: from_sql ( type_, raw) ?;
92
+ let utc = DateTime :: < Utc > :: from_sql ( type_, raw) ?;
93
93
Ok ( utc. with_timezone ( & FixedOffset :: east ( 0 ) ) )
94
94
}
95
95
@@ -101,7 +101,7 @@ impl ToSql for DateTime<FixedOffset> {
101
101
type_ : & Type ,
102
102
w : & mut Vec < u8 > )
103
103
-> Result < IsNull , Box < Error + Sync + Send > > {
104
- self . with_timezone ( & UTC ) . to_sql ( type_, w)
104
+ self . with_timezone ( & Utc ) . to_sql ( type_, w)
105
105
}
106
106
107
107
accepts ! ( Type :: Timestamptz ) ;
0 commit comments