Skip to content

Commit 2e42c6b

Browse files
committed
feat: use DateTime<Utc> when query timestamp offset for end user
1 parent 7912b25 commit 2e42c6b

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ compression-gzip = ["flate2"]
7474
compression-lz4 = ["lz4"]
7575
compression-snappy = ["snap"]
7676
compression-zstd = ["zstd"]
77-
timestamp-query = []
7877

7978
transport-socks5 = ["async-socks5"]
8079
transport-tls = ["rustls", "tokio-rustls"]

src/client/partition.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::{
2323
throttle::maybe_throttle,
2424
validation::ExactlyOne,
2525
};
26-
use chrono::{LocalResult, TimeZone, Utc};
26+
use chrono::{DateTime, LocalResult, TimeZone, Utc};
2727
use std::{
2828
ops::{ControlFlow, Deref, Range},
2929
sync::Arc,
@@ -98,9 +98,8 @@ pub enum OffsetAt {
9898
/// The latest existing record.
9999
Latest,
100100

101-
#[cfg(feature = "timestamp-query")]
102101
/// Timestamp
103-
Timestamp(i64),
102+
Timestamp(DateTime<Utc>),
104103
}
105104

106105
#[derive(Debug)]
@@ -906,8 +905,7 @@ fn build_list_offsets_request(partition: i32, topic: &str, at: OffsetAt) -> List
906905
let timestamp = match at {
907906
OffsetAt::Earliest => -2,
908907
OffsetAt::Latest => -1,
909-
#[cfg(feature = "timestamp-query")]
910-
OffsetAt::Timestamp(ts) => ts,
908+
OffsetAt::Timestamp(ts) => ts.timestamp_millis(),
911909
};
912910

913911
ListOffsetsRequest {

0 commit comments

Comments
 (0)