pub struct TimeUtils;Expand description
Time utilities for consistent time handling
Implementations§
Source§impl TimeUtils
impl TimeUtils
Sourcepub fn format_duration(duration: Duration) -> String
pub fn format_duration(duration: Duration) -> String
Format a duration in a human-readable way
Sourcepub fn format_timestamp(time: DateTime<Local>) -> String
pub fn format_timestamp(time: DateTime<Local>) -> String
Format a timestamp in a consistent way
Sourcepub fn format_relative(time: DateTime<Local>) -> String
pub fn format_relative(time: DateTime<Local>) -> String
Format a timestamp as relative time (e.g., “2 hours ago”)
Sourcepub fn system_time_to_local(time: SystemTime) -> DateTime<Local>
pub fn system_time_to_local(time: SystemTime) -> DateTime<Local>
Convert SystemTime to DateTime
Sourcepub fn parse_iso8601(s: &str) -> Result<DateTime<Utc>, ParseError>
pub fn parse_iso8601(s: &str) -> Result<DateTime<Utc>, ParseError>
Parse ISO 8601 timestamp
Auto Trait Implementations§
impl Freeze for TimeUtils
impl RefUnwindSafe for TimeUtils
impl Send for TimeUtils
impl Sync for TimeUtils
impl Unpin for TimeUtils
impl UnwindSafe for TimeUtils
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more