Add timer

master
Benoît 2018-05-08 14:18:59 +02:00
parent 19fcd69cb0
commit 1b5157b80a
3 changed files with 23 additions and 0 deletions

12
Cargo.lock generated
View File

@ -92,6 +92,7 @@ dependencies = [
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -159,6 +160,16 @@ dependencies = [
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "time"
version = "0.1.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "typenum"
version = "1.10.0"
@ -223,6 +234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098"
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"

View File

@ -8,3 +8,4 @@ clap = "*"
term = "*"
sha2 = "0.7.1"
walkdir = "*"
time = "*"

View File

@ -2,6 +2,9 @@ extern crate clap;
extern crate term;
extern crate sha2;
extern crate walkdir;
extern crate time;
use time::PreciseTime;
use sha2::{Sha256, Digest};
@ -202,6 +205,7 @@ fn main() {
process::exit(1);
}
let start = PreciseTime::now();
// Walk through path 1 & 2 [Todo: threading]
let mut children = vec![];
let args_source = vec![args.input, args.output];
@ -243,6 +247,12 @@ fn main() {
println!("{}", i);
}
// Condition: Filename (basename) Must be the same (?)
// whatever you want to do
let end = PreciseTime::now();
println!("{} seconds.", start.to(end));
t.reset().unwrap();
t.fg(term::color::CYAN).unwrap();
println!("Cheers !");