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

#204 in Date and time

Download history 14/week @ 2024-02-02 18/week @ 2024-02-09 21/week @ 2024-02-16 39/week @ 2024-02-23 8/week @ 2024-03-01 11/week @ 2024-03-08 14/week @ 2024-03-15 6/week @ 2024-03-22 23/week @ 2024-03-29 11/week @ 2024-04-05

55 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