libpna 0.31.1

PNA(Portable-Network-Archive) decoding and encoding library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::Duration;
use std::time::SystemTime;

/// [`SystemTime`] extension trait.
pub trait SystemTimeExt {
    /// Returns the duration since the Unix epoch.
    fn duration_since_unix_epoch_signed(&self) -> Duration;
}

impl SystemTimeExt for SystemTime {
    /// Returns the duration since the Unix epoch.
    #[inline]
    fn duration_since_unix_epoch_signed(&self) -> Duration {
        time::OffsetDateTime::from(*self) - time::OffsetDateTime::UNIX_EPOCH
    }
}