Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnwa committed Mar 18, 2020
1 parent 6ee16ea commit 73d8fbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ms-converter"
version = "0.7.0"
version = "0.7.1"
authors = ["Mnwa <mihan@panfilov.biz>"]
edition = "2018"
description = "Fast abstraction for converting human-like times into milliseconds."
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
use std::fmt::Formatter;
use std::time::Duration;

/// How many milliseconds in one second
pub const SECOND: f64 = 1000_f64;
/// How many milliseconds in one minute
pub const MINUTE: f64 = SECOND * 60_f64;
/// How many milliseconds in one hour
pub const HOUR: f64 = MINUTE * 60_f64;
/// How many milliseconds in one day
pub const DAY: f64 = HOUR * 24_f64;
/// How many milliseconds in one week
pub const WEEK: f64 = DAY * 7_f64;
/// How many milliseconds in one year
pub const YEAR: f64 = DAY * 365.25_f64;

/// Fast abstraction for converting human-like times into milliseconds.
Expand Down Expand Up @@ -127,6 +133,7 @@ pub fn ms_into_time(s: &str) -> Result<Duration, Error> {
Ok(Duration::from_millis(milliseconds as u64))
}

/// Error what return ms converter functions in runtime, if something is going wrong.
#[derive(Debug)]
pub struct Error {
message: &'static str,
Expand Down

0 comments on commit 73d8fbd

Please sign in to comment.