Crate filetime_type

source ·
Expand description

An independent FILETIME parsing / conversion crate

The need for this came up when attempting to parse raw FILETIME structures from binary files.


use filetime_type::FileTime;
use chrono::{DateTime, Utc};

// Create FileTime from current system time
let ft_now = FileTime::now();

// Parsing from i64
let ft_i64 = FileTime::from_i64(128930364000001000);
println!("Since FILETIME-Epoch: secs: {} leap-nanosecs: {}",

// Parsing from raw bytes
let raw_filetime: [u8; 8] = [0xCE, 0xEB, 0x7D, 0x1A, 0x61, 0x59, 0xCE, 0x01];
let ft = FileTime::from(raw_filetime);

// Into raw bytes
let raw: [u8; 8] = FileTime::now().into();

// Parsing from DateTime<Utc>
let ft_dt = FileTime::from_datetime(Utc::now());