pub struct Filetime { /* private fields */ }Expand description
Simplifies handling Windows filetime dates. Use only with UTC dates as it does not take time zones into account. Eliminates the need to use the chrono library. Its more complex than WinFiletime and uses more space, but its much faster when getting date parameters like hour,minute,day… as it parses the date when created.
use forensic_rs::prelude::*;
assert_eq!("01-01-1601 00:00:00", format!("{:?}", Filetime::new(0)));
assert_eq!("01-01-1605 00:00:00", format!("{:?}", Filetime::new(1262304000000000)));
assert_eq!("14-11-1999 18:27:59", format!("{:?}", Filetime::new(125870776790000000)));
assert_eq!("14-11-2000 18:27:59.001", format!("{:?}", Filetime::new(126187000790010000)));
assert_eq!(2000, Filetime::new(126187000790010000).year());
assert_eq!(100, Filetime::new(126187000790000001).nanoseconds());Implementations§
Source§impl Filetime
impl Filetime
Sourcepub fn with_ymd_and_hms(
year: u16,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
nanos: u32,
) -> Self
pub fn with_ymd_and_hms( year: u16, month: u8, day: u8, hour: u8, minute: u8, second: u8, nanos: u32, ) -> Self
Make a new Filetime from year, month, day, time components assuming UTC.
Sourcepub fn year(&self) -> u16
pub fn year(&self) -> u16
Returns the year number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(2000, time.year());Sourcepub fn month(&self) -> u8
pub fn month(&self) -> u8
Returns the month number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(2, time.month());Sourcepub fn day(&self) -> u8
pub fn day(&self) -> u8
Returns the day number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(29, time.day());Sourcepub fn hour(&self) -> u8
pub fn hour(&self) -> u8
Returns the hour number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(18, time.hour());Sourcepub fn minute(&self) -> u8
pub fn minute(&self) -> u8
Returns the minute number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(27, time.minute());Sourcepub fn second(&self) -> u8
pub fn second(&self) -> u8
Returns the second number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(59, time.second());Sourcepub fn millis(&self) -> u32
pub fn millis(&self) -> u32
Returns the second number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(1, time.millis());Sourcepub fn nanoseconds(&self) -> u32
pub fn nanoseconds(&self) -> u32
Returns the nanoseconds number
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(1000000, time.nanoseconds());Sourcepub fn filetime(&self) -> u64
pub fn filetime(&self) -> u64
Returns the original filetime since 1601
use forensic_rs::prelude::*;
let time = Filetime::new(125963224790010000); // 29-02-2000 18:27:59.001
assert_eq!(125963224790010000, time.filetime());Sourcepub fn duration_since(&self, earlier: SystemTime) -> Result<Duration, Duration>
pub fn duration_since(&self, earlier: SystemTime) -> Result<Duration, Duration>
Returns the amount of time elapsed from an earlier point in time.
This function may fail because measurements taken earlier are not guaranteed to always be before later measurements (due to anomalies such as the system clock being adjusted either forwards or backwards). Instant can be used to measure elapsed time without this risk of failure.
If successful, Ok(Duration) is returned where the duration represents the amount of time elapsed from the specified measurement to this one.
Returns an Err if earlier is later than self, and the error contains how far from self the time is.
Trait Implementations§
Source§impl AddAssign<Duration> for Filetime
impl AddAssign<Duration> for Filetime
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+= operation. Read more