Skip to content

Commit 2de663c

Browse files
committed
Add impl for the time-crate counterpart
1 parent 0bddfe6 commit 2de663c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

influxdb/src/query/write_query.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ impl<Tz: chrono::TimeZone> From<chrono::DateTime<Tz>> for Type {
167167
}
168168
}
169169

170+
#[cfg(feature = "time")]
171+
impl From<time::UtcDateTime> for Type {
172+
fn from(dt: time::UtcDateTime) -> Self {
173+
Type::SignedInteger(dt.unix_timestamp_nanos().try_into().unwrap_or(0))
174+
}
175+
}
176+
170177
impl<T> From<&T> for Type
171178
where
172179
T: Copy + Into<Type>,

0 commit comments

Comments
 (0)