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

Download history 30/week @ 2024-03-13 72/week @ 2024-03-20 31/week @ 2024-03-27 33/week @ 2024-04-03 1/week @ 2024-04-10 6/week @ 2024-04-17 17/week @ 2024-04-24 22/week @ 2024-05-01 50/week @ 2024-05-08 15/week @ 2024-05-15 48/week @ 2024-05-22 135/week @ 2024-05-29 51/week @ 2024-06-05 23/week @ 2024-06-12 43/week @ 2024-06-19 57/week @ 2024-06-26

194 downloads per month
Used in 4 crates

MIT license

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