#date #time #windows

no-std nt-time

A Windows file time library

17 releases (5 breaking)

0.6.7 Jan 18, 2024
0.6.5 Dec 7, 2023
0.6.3 Nov 26, 2023
0.5.0 May 15, 2023
0.1.0 Mar 27, 2023

#51 in Date and time

Download history 9248/week @ 2023-10-26 8850/week @ 2023-11-02 9039/week @ 2023-11-09 8966/week @ 2023-11-16 10125/week @ 2023-11-23 8641/week @ 2023-11-30 8839/week @ 2023-12-07 8530/week @ 2023-12-14 6789/week @ 2023-12-21 6865/week @ 2023-12-28 7530/week @ 2024-01-04 7289/week @ 2024-01-11 4804/week @ 2024-01-18 5326/week @ 2024-01-25 5021/week @ 2024-02-01 4208/week @ 2024-02-08

20,302 downloads per month
Used in 15 crates (3 directly)

Apache-2.0 OR MIT

215KB
4.5K SLoC

nt-time

CI Version Docs License

nt-time is a Windows file time library for Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
nt-time = "0.6.7"

Example

use core::time::Duration;

use nt_time::{
    time::{macros::datetime, OffsetDateTime},
    FileTime,
};

let ft = FileTime::NT_TIME_EPOCH;
assert_eq!(
    OffsetDateTime::try_from(ft).unwrap(),
    datetime!(1601-01-01 00:00 UTC)
);

let ft = ft + Duration::from_secs(11_644_473_600);
assert_eq!(
    OffsetDateTime::try_from(ft).unwrap(),
    OffsetDateTime::UNIX_EPOCH
);
assert_eq!(ft.to_raw(), 116_444_736_000_000_000);

assert_eq!(FileTime::new(u64::MAX), FileTime::MAX);

Crate features

std

Enables features that depend on the standard library. This is enabled by default.

large-dates

Enables the large-dates feature of the time crate.

chrono

Enables the chrono crate.

serde

Enables the serde crate.

serde-human-readable

Allows Serde representations to use a human-readable format. This implicitly enables the serde feature.

no_std support

This supports no_std mode. Disables the default feature to enable this.

Documentation

See the documentation for more details.

Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.65.0.

Changelog

Please see CHANGELOG.adoc.

Contributing

Please see CONTRIBUTING.adoc.

License

Copyright © 2023–2024 Shun Sakai (see AUTHORS.adoc)

This library is distributed under the terms of either the Apache License 2.0 or the MIT License.

This project is compliant with version 3.0 of the REUSE Specification. See copyright notices of individual files for more details on copyright and licensing information.

Dependencies

~0.7–1.2MB
~22K SLoC