diff --git a/Cargo.lock b/Cargo.lock index 43dfd70..bd53f31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,6 +75,19 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + [[package]] name = "cloudabi" version = "0.0.3" @@ -307,7 +320,7 @@ checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" dependencies = [ "cfg-if 0.1.10", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] @@ -640,6 +653,25 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg 1.0.1", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg 1.0.1", +] + [[package]] name = "num_cpus" version = "1.13.0" @@ -808,6 +840,7 @@ name = "prague" version = "0.1.0" dependencies = [ "byteorder", + "chrono", "indicatif", "itertools", "rand 0.8.0", @@ -1349,6 +1382,17 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "tinyvec" version = "1.1.1" @@ -1521,6 +1565,12 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasm-bindgen" version = "0.2.70" diff --git a/Cargo.toml b/Cargo.toml index 085fec8..1a02c32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ rusqlite = "0.24.2" regex = "1.4.3" rayon = "1.5.0" soup = "0.5.0" +chrono = "0.4.19" [dependencies.reqwest] version = "0.11.0" diff --git a/src/upload-bot.rs b/src/upload-bot.rs index 0fca0f7..f0b767f 100644 --- a/src/upload-bot.rs +++ b/src/upload-bot.rs @@ -5,8 +5,9 @@ use soup::prelude::*; use std::fmt::Write; use std::io::Error; use std::thread::sleep; -use std::time::Duration; use std::process::exit; +use std::time::Duration; +use chrono::Local; mod optimization; mod city; @@ -30,7 +31,8 @@ fn main() { loop { if let Some((contestant, score)) = get_top_score() { - eprintln!("Top score found: {} by {}", score, contestant); + let time = Local::now(); + eprintln!("[{}] Top score found: {} by {}", time.format("%H:%M:%S"), score, contestant); if contestant != "Jirka Sejkora (org)" { eprintln!("Wrong contestant, trying to one-up.");