4 releases

0.1.3 Nov 29, 2023
0.1.2 Nov 13, 2022
0.1.1 Nov 13, 2022
0.1.0 Nov 12, 2022

#300 in Date and time

Download history 1/week @ 2024-07-30 1/week @ 2024-08-06 1/week @ 2024-09-17 13/week @ 2024-09-24 1/week @ 2024-10-01 1/week @ 2024-10-08

264 downloads per month

MIT license

10KB
177 lines

filetime_type - Platform-agnostic FILETIME conversion library

Crates.io Docs.rs CI

An independent FILETIME parsing / conversion crate

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

Documentation

Please see: https://docs.rs/filetime_type

Add to your project

Add the following line to your Cargo.toml file.

[dependencies]
filetime_type = "0.1"
  • nt-time - Does serve the same purpose + serde support + more tests

lib.rs:

An independent FILETIME parsing / conversion crate

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

Quickstart

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: {}",
    ft_i64.seconds(),
    ft_i64.nanoseconds());

// 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());

Dependencies

~1MB
~18K SLoC