Remove crate time

What the crate `time' did was simple enough to rewrite it easily
This commit is contained in:
Lucien Cartier-Tilet 2020-08-11 18:26:40 +02:00
parent 175b907afb
commit 4e2acb9682
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
4 changed files with 7 additions and 62 deletions

53
Cargo.lock generated
View File

@ -90,7 +90,7 @@ checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6"
dependencies = [ dependencies = [
"num-integer", "num-integer",
"num-traits", "num-traits",
"time 0.1.43", "time",
] ]
[[package]] [[package]]
@ -382,12 +382,6 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "proc-macro-hack"
version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.19" version = "1.0.19"
@ -404,7 +398,6 @@ dependencies = [
"battery", "battery",
"clap", "clap",
"notify-rust", "notify-rust",
"time 0.2.16",
] ]
[[package]] [[package]]
@ -451,15 +444,6 @@ dependencies = [
"crossbeam-utils", "crossbeam-utils",
] ]
[[package]]
name = "standback"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0437cfb83762844799a60e1e3b489d5ceb6a650fbacb86437badc1b6d87b246"
dependencies = [
"version_check",
]
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.8.0" version = "0.8.0"
@ -537,41 +521,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "time"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15"
dependencies = [
"cfg-if",
"standback",
"time-macros",
"version_check",
]
[[package]]
name = "time-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d"
dependencies = [
"proc-macro-hack",
"time-macros-impl",
]
[[package]]
name = "time-macros-impl"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa"
dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote 1.0.7",
"standback",
"syn 1.0.38",
]
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.12.0" version = "1.12.0"

View File

@ -14,4 +14,3 @@ publish = false
battery = { version = "0.7.5", default-features = false } battery = { version = "0.7.5", default-features = false }
notify-rust = { version = "4", default-features = false } notify-rust = { version = "4", default-features = false }
clap = { version = "3.0.0-beta.1", default-features = false, features = ["std", "derive"] } clap = { version = "3.0.0-beta.1", default-features = false, features = ["std", "derive"] }
time = { version = "0.2", default-features = false }

View File

@ -14,8 +14,8 @@
** Built with ** Built with
[[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]] [[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]]
PumoPM is written in pure, stable Rust (at least >= 1.45.2). Its four PumoPM is written in pure, stable Rust (at least >= 1.45.2). Its three
dependencies are the crates [[https://github.com/svartalf/rust-battery][battery]], [[https://clap.rs/][clap]], [[https://crates.io/crates/time][time]], and [[https://github.com/hoodie/notify-rust][notify-rust]]. dependencies are the crates [[https://github.com/svartalf/rust-battery][battery]], [[https://clap.rs/][clap]], and [[https://github.com/hoodie/notify-rust][notify-rust]].
** What does Pumo mean? ** What does Pumo mean?
Its my cats name. Its my cats name.

View File

@ -129,13 +129,10 @@ impl BatteryState {
match time { match time {
Some(e) => { Some(e) => {
let time = e.value as u64; let time = e.value as u64;
let time = time::Time::try_from_hms( let hours = time / 3600;
(time / 3600) as u8, let minutes = (time % 3600) / 60;
((time % 3600) / 60) as u8, let seconds = time % 60;
(time % 60) as u8, format!("{:01}:{:02}:{:02}", hours, minutes, seconds)
)
.unwrap();
time.to_string()
} }
None => { None => {
eprintln!("Couldnt read remaining time"); eprintln!("Couldnt read remaining time");