docs.rs failed to build utc2k-0.18.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
utc2k-0.18.2
UTC2K
UTC2K is a heavily-optimized — and extremely niche — date/time library that only supports UTC happenings in this century.
For the moments between 2000-01-01 00:00:00..=2099-12-31 23:59:59, it can run circles around crates like chrono and time, while still being able to:
- Determine "now", at least until the final seconds of 2099;
- Convert to/from Unix timestamps;
- Convert to/from all sorts of different date/time strings;
- Perform checked and saturating addition/subtraction;
- Calculate ordinals, weekdays, leap years, etc.;
Examples
The library's main export is Utc2k, a Copy-friendly struct representing a specific UTC datetime.
use ;
// Instantiation, four ways:
let date = now; // The current system time.
let date = new; // From parts.
let date = from_unixtime; // From a timestamp.
let date = from_ascii // From a datetime string.
.unwrap;
// What day was Halloween 2024, anyway?
assert_eq!;
// Ordinals are a kind of bird, right?
assert_eq!;
// Boss wants an RFC2822 for some reason?
assert_eq!;
Optional Crate Features
local: Enables theLocal2k/FmtLocal2kstructs. Refer to the documentation for important caveats and limitations.serde: Enables serialization/deserialization support.sqlx-mysql: Enablessqlx(mysql) support forUtc2k.
Installation
Add utc2k to your dependencies in Cargo.toml, like:
[]
= "0.17.*"