Skip to content

Commit b8d859a

Browse files
authored
Remove extra datetime conversions (#837)
1 parent 798d16d commit b8d859a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/io/geozero/table/builder/anyvalue.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl AnyBuilder {
5959
builder.append_null();
6060
}
6161

62-
builder.append_value(value.naive_utc().and_utc().timestamp_micros());
62+
builder.append_value(value.timestamp_micros());
6363
AnyBuilder::DateTime((builder, tz))
6464
}
6565

@@ -110,8 +110,8 @@ impl AnyBuilder {
110110
for _ in 0..row_index {
111111
builder.append_null();
112112
}
113-
let naive = string_to_datetime(&Utc, val).unwrap().naive_utc();
114-
builder.append_value(naive.and_utc().timestamp_micros());
113+
let dt = string_to_datetime(&Utc, val).unwrap();
114+
builder.append_value(dt.timestamp_micros());
115115
AnyBuilder::DateTime((builder, None))
116116
}
117117
ColumnValue::Binary(val) => {
@@ -154,7 +154,7 @@ impl AnyBuilder {
154154
pub(crate) fn add_timestamp_value(&mut self, value: DateTime<Utc>) -> Result<()> {
155155
match self {
156156
AnyBuilder::DateTime((arr, _tz)) => {
157-
arr.append_value(value.naive_utc().and_utc().timestamp_micros());
157+
arr.append_value(value.timestamp_micros());
158158
}
159159
builder_type => {
160160
return Err(GeoArrowError::General(format!(
@@ -193,8 +193,8 @@ impl AnyBuilder {
193193
Binary(v) => impl_add_value!(as_binary_mut, v),
194194
DateTime(v) => {
195195
let (arr, _tz) = self.as_date_time_mut().unwrap();
196-
let naive = string_to_datetime(&Utc, v).unwrap().naive_utc();
197-
arr.append_value(naive.and_utc().timestamp_micros());
196+
let dt = string_to_datetime(&Utc, v).unwrap();
197+
arr.append_value(dt.timestamp_micros());
198198
}
199199
}
200200

0 commit comments

Comments
 (0)