Skip to content

Commit

Permalink
fix the bad fix
Browse files Browse the repository at this point in the history
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
  • Loading branch information
zhongzc committed Sep 26, 2023
1 parent 981500f commit f849dfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/time/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl DateTime {
}

pub fn to_chrono_datetime(&self) -> Option<NaiveDateTime> {
NaiveDateTime::from_timestamp_opt(self.0 / 1000, 0)
NaiveDateTime::from_timestamp_millis(self.0)
}

pub fn to_date(&self) -> Option<Date> {
Expand Down Expand Up @@ -165,7 +165,7 @@ mod tests {

#[test]
fn test_conversion_between_datetime_and_chrono_datetime() {
let cases = [1000, 100000, 1000000];
let cases = [1, 10, 100, 1000, 100000];
for case in cases {
let dt = DateTime::new(case);
let ndt = dt.to_chrono_datetime().unwrap();
Expand Down

0 comments on commit f849dfd

Please sign in to comment.