In September 2019, I requested to take over the unmaintained time in Rust. As anyone that has ever worked with time can attest to, this is no small feat. By December, I had released the first major release in over six years. As a foundational crate in the Rust ecosystem, time is used by a significant portion of the Rust ecosystem.

The revamped time includes extensive documentation and nearly 100% test coverage. Macros are provided to allow for compile-time verification of certain data, avoiding unnecessary runtime costs. Formatting and parsing is done via a more readable syntax, and is significantly more extensible than the implementations in other crates. The crate is also fully #![no_std] compatible, allowing it to be used in embedded environments. time is fully interoperable with the standard library's types, allowing for easy conversion and direct use with one another.

During my maintenance of time, I have focused on providing a stable, reliable crate that has the features that users need. Compile time is important, so there are many feature flags to limit the number of dependencies compiled to only those needed by the user. However, runtime is also important, which is why I have spent a fair amount of effort on optimization. As an example, I adapted a well-known algorithm to better suit the internal data format, improving performance by 70% in some cases.


The num_threads Rust crate lets you determine the number of threads that are part of the running process. This is useful for determining the number of threads currently in use as part of a thread pool, for example. This crate was originally part of time, but was split out as it can be useful for other users. In time, is it used to determine if certain methods can be soundly called.


During development of time, I frequently found myself writing shims to allow the use of recently-stabilized APIs on older compilers. However, it was necessary to use .rem_euclid_shim() instead of .rem_euclid() to avoid name collisions on newer compilers.

As it turned out, it's not too difficult to bring code from Rust's standard library to the standback Rust crate, allowing the use on older compilers. By gating and aliasing to std (or core as appropriate), it was possible to avoid this. This turns out to be incredibly useful as a standalone crate; it allows others to use newer APIs with near-zero effort: just a single line of code per file for most use cases.

Unfortunately, time was the only crate that made use of standback, so maintenance ceased after Rust's 1.60.0 release, as time migrated away from it to reduce compile times.


deranged is a proof-of-concept Rust crate for range-bound integers. It is intended to serve as a proving ground for a future RFC to add this functionality to Rust itself. It supports a large number of methods present on primitive integers, and will support arithmetic traits when rustc supports the necessary language features on stable.