compound_duration

Crates.iocompound_duration
lib.rscompound_duration
version1.2.1
sourcesrc
created_at2019-06-15 16:58:38.971591
updated_at2023-04-18 18:31:56.933403
descriptionConvert seconds to compound duration (week, days, hours, minutes, seconds)
homepagehttps://docs.rs/compound_duration/latest/compound_duration/
repositoryhttps://github.com/nbari/compound_duration
max_upload_size
id141373
size14,123
(nbari)

documentation

https://docs.rs/compound_duration/latest/compound_duration/

README

compound_duration

crates.io Build Status

Convert seconds to compound duration (week, days, hours, minutes, seconds)

input number output string
7259 2h59s
86400 1d
6000000 9w6d10h40m
4294967295 7101w3d6h28m15s

format_dhms or format_wdhms, example:

use compound_duration::format_dhms;
use std::time::Instant;

fn main() {
    let now = Instant::now();
    // do something ...
    println!("{}", format_dhms(now.elapsed().as_secs()));
}

If need nanoseconds use format_ns:

use compound_duration::format_ns;
use std::time::Instant;

fn main() {
    let now = Instant::now();
    // do something ...
    println!("{}", format_ns(now.elapsed().as_nanos()));
}
Commit count: 19

cargo fmt