19 releases

0.6.9 Mar 3, 2024
0.6.7 Jan 18, 2024
0.6.5 Dec 7, 2023
0.6.3 Nov 26, 2023
0.1.0 Mar 27, 2023

#39 in Date and time

Download history 8697/week @ 2023-12-06 8212/week @ 2023-12-13 6971/week @ 2023-12-20 6576/week @ 2023-12-27 7383/week @ 2024-01-03 7207/week @ 2024-01-10 4969/week @ 2024-01-17 5029/week @ 2024-01-24 4514/week @ 2024-01-31 4466/week @ 2024-02-07 4293/week @ 2024-02-14 4257/week @ 2024-02-21 4388/week @ 2024-02-28 4027/week @ 2024-03-06 4064/week @ 2024-03-13 3971/week @ 2024-03-20

17,188 downloads per month
Used in 17 crates (3 directly)

Apache-2.0 OR MIT

230KB
5K SLoC

nt-time

CI Version MSRV Docs License

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

Usage

Add this to your Cargo.toml:

[dependencies]
nt-time = "0.6.9"

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