Skip to content

Commit

Permalink
fix: remove deprecated function
Browse files Browse the repository at this point in the history
  • Loading branch information
SkuldNorniern committed Mar 13, 2024
1 parent 7270bfe commit cbe6a6f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/net/parser/time.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
use chrono::prelude::*;
use chrono::DateTime;

#[inline]
pub fn parse_microseconds(sec: u64, usec: u64) -> u64 {
sec * 1000000 + usec
}

#[inline]
pub fn microseconds_to_timestamp(usec: u64) -> String {
let naive = NaiveDateTime::from_timestamp_opt(usec as i64, 0);

let naive = DateTime::from_timestamp(usec as i64, 0).unwrap().naive_utc();
#[cfg(not(target_os = "windows"))]
let datetime = DateTime::<Utc>::from_naive_utc_and_offset(naive.unwrap(), Utc);
let datetime = DateTime::<Utc>::from_naive_utc_and_offset(naive, Utc);

#[cfg(target_os = "windows")]
let datetime = DateTime::<Utc>::from_utc(naive.unwrap(), Utc);
Expand Down

0 comments on commit cbe6a6f

Please sign in to comment.