6 releases
0.1.5 | Jul 8, 2021 |
---|---|
0.1.4 | Jul 6, 2021 |
0.1.3 | Dec 17, 2020 |
0.1.2 | Nov 26, 2020 |
#569 in Unix APIs
194 downloads per month
Used in 4 crates
11KB
96 lines
unix-time
A minimalist Rust crate to play with UNIX epoch-based Instant.
Using it
Simply add this to your Cargo.toml
:
[dependencies]
unix-time = "0.1"
You can then use the defined Instant
using
use unix_time::Instant;
// Do whatever you want with Instant
lib.rs
:
A minimal crate to play with Instant based on UNIX epoch.
The standard library provides Instant and Duration structures to measure elapsed time. This is fine for most use cases, but the Instant structure voluntary hides its implementation to keep its semantics. This crate exposes its time base to the UNIX Epoch (1st January 1970 at 0:00).
The exposed API tries to mimic as much as possible the std::time
one for
the related Instant
structures, such that passing from these to the ones
of this crate would be as seamless as possible (as it actually uses
std::time
under the hood).
This crate should only be used to compute local time. It is thus not appropriate for timezone computations, playing with dates,...
Dependencies
~1.1–1.7MB
~41K SLoC