#time #date-time #tai #monotonic #date #timestamp

no-std monotonic-time

A simple lightweight crate to convert seconds provided to Coordinated Universal Time (UTC) or Temps Atomique International (TAI)

3 stable releases

1.0.2 Jul 24, 2022
1.0.1 Jun 30, 2022

#344 in Date and time


Used in web3utilities

Apache-2.0 OR MIT

11KB
149 lines

Monotonic-Time

A simple lightweight crate to convert seconds provided to Coordinated Universal Time (UTC) or Temps Atomique International (TAI).

Rust crates.io

Instantiate a DateTime

use monotonic_time::DateTime;

let mut datetime = DateTime::new();

Convert Seconds to UTC

use monotonic_time::DateTime;

let now = 1656603896;
let mut datetime = DateTime::new();
datetime.to_datetime(now);
println!("{}", datetime)

Convert Seconds to TAI

use monotonic_time::DateTime;

let now = 1656603896;
let mut datetime = DateTime::new();
// Pass in the seconds and the offset of UTC from TAI
datetime.to_taitime(now, 37);
println!("{}", datetime)

LICENSING

This crate is Licensed under Apache-2.0 or MIT

CONTRIBUTING

All contributions must adhere to the crate's code and the Rust Code of Conduct - https://www.rust-lang.org/policies/code-of-conduct

No runtime deps

Features