diff --git a/sqlx-core/src/lib.rs b/sqlx-core/src/lib.rs index 9e50d0d842..a7a9d2d352 100644 --- a/sqlx-core/src/lib.rs +++ b/sqlx-core/src/lib.rs @@ -104,3 +104,7 @@ pub mod mssql; /// sqlx uses ahash for increased performance, at the cost of reduced DoS resistance. use ahash::AHashMap as HashMap; //type HashMap = std::collections::HashMap; + +#[macro_use] +#[cfg(feature = "time-03")] +extern crate time_03 as time; diff --git a/sqlx-core/src/postgres/types/time_02/datetime.rs b/sqlx-core/src/postgres/types/time_02/datetime.rs index aa032743d6..30bf6415ef 100644 --- a/sqlx-core/src/postgres/types/time_02/datetime.rs +++ b/sqlx-core/src/postgres/types/time_02/datetime.rs @@ -6,7 +6,7 @@ use crate::postgres::{PgArgumentBuffer, PgTypeInfo, PgValueFormat, PgValueRef, P use crate::types::Type; use std::borrow::Cow; use std::mem; -use time_02::{offset, Duration, OffsetDateTime, PrimitiveDateTime}; +use time_02::{UtcOffset, Duration, OffsetDateTime, PrimitiveDateTime}; impl Type for PrimitiveDateTime { fn type_info() -> PgTypeInfo { @@ -102,7 +102,7 @@ impl<'r> Decode<'r, Postgres> for PrimitiveDateTime { impl Encode<'_, Postgres> for OffsetDateTime { fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull { - let utc = self.to_offset(offset!(UTC)); + let utc = self.to_offset(UtcOffset::UTC); let primitive = PrimitiveDateTime::new(utc.date(), utc.time()); Encode::::encode(&primitive, buf) diff --git a/sqlx-core/src/postgres/types/time_02/mod.rs b/sqlx-core/src/postgres/types/time_02/mod.rs index 3d8229505d..40a8af1642 100644 --- a/sqlx-core/src/postgres/types/time_02/mod.rs +++ b/sqlx-core/src/postgres/types/time_02/mod.rs @@ -3,4 +3,4 @@ mod datetime; mod time; #[rustfmt::skip] -const PG_EPOCH: ::time_02::Date = ::time_02::date!(2000-1-1); +const PG_EPOCH: time_02::Date = time_02::internals::Date::from_yo_unchecked(2000, 1);