1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Copyright (C) 2023 Shun Sakai
//
//! The `nt-time` crate is a [Windows file time][file-time-docs-url] library.
//!
//! This is used as timestamps such as Windows and [7z][7z-format-url].
//!
//! # Examples
//!
//! ```
//! use core::time::Duration;
//!
//! use nt_time::{time::OffsetDateTime, FileTime};
//!
//! let ft = FileTime::NT_TIME_EPOCH;
//! assert_eq!(
//! OffsetDateTime::try_from(ft).unwrap().to_string(),
//! "1601-01-01 0:00:00.0 +00:00:00"
//! );
//!
//! let ft = ft + Duration::from_secs(11_644_473_600);
//! assert_eq!(
//! OffsetDateTime::try_from(ft).unwrap(),
//! OffsetDateTime::UNIX_EPOCH
//! );
//! assert_eq!(ft.as_u64(), 116_444_736_000_000_000);
//!
//! assert_eq!(FileTime::new(u64::MAX), FileTime::MAX);
//! ```
//!
//! [file-time-docs-url]: https://docs.microsoft.com/en-us/windows/win32/sysinfo/file-times
//! [7z-format-url]: https://www.7-zip.org/7z.html
#![doc(html_root_url = "https://docs.rs/nt-time/0.4.0/")]
#![no_std]
#![cfg_attr(doc_cfg, feature(doc_auto_cfg, doc_cfg))]
// Lint levels of rustc.
#![forbid(unsafe_code)]
#![deny(missing_debug_implementations, missing_docs)]
#![warn(rust_2018_idioms)]
// Lint levels of Clippy.
#![warn(clippy::cargo, clippy::nursery, clippy::pedantic)]
#[cfg(test)]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
pub mod error;
mod file_time;
#[cfg(feature = "serde")]
pub mod serde_with;
#[cfg(feature = "chrono")]
pub use chrono;
#[cfg(feature = "serde")]
pub use serde;
pub use time;
pub use crate::file_time::FileTime;