Skip to content

Commit d84f3c6

Browse files
authored
fix(query): use local time for query log (#17963)
1 parent 3acf8ea commit d84f3c6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/query/storages/system/src/query_log_table.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn date_str<S>(dt: &i32, s: S) -> std::result::Result<S::Ok, S::Error>
7171
where S: Serializer {
7272
let t = DateTime::from_timestamp(i64::from(*dt) * 24 * 3600, 0)
7373
.unwrap()
74-
.naive_utc();
74+
.with_timezone(&chrono::Local);
7575
s.serialize_str(t.format("%Y-%m-%d").to_string().as_str())
7676
}
7777

@@ -80,11 +80,10 @@ where S: Serializer {
8080
let t = DateTime::from_timestamp(
8181
dt / 1_000_000,
8282
TryFrom::try_from((dt % 1_000_000) * 1000).unwrap_or(0),
83-
// u32::try_from((dt % 1_000_000) * 1000).unwrap_or(0),
8483
)
8584
.unwrap()
86-
.naive_utc();
87-
s.serialize_str(t.format("%Y-%m-%d %H:%M:%S%.6f").to_string().as_str())
85+
.with_timezone(&chrono::Local);
86+
s.serialize_str(t.to_rfc3339().to_string().as_str())
8887
}
8988

9089
#[derive(Clone, Serialize)]

0 commit comments

Comments
 (0)