diff --git a/core/src/util/mod.rs b/core/src/util/mod.rs index 01a3a506..f9304f0b 100644 --- a/core/src/util/mod.rs +++ b/core/src/util/mod.rs @@ -8,7 +8,6 @@ use std::ops::{Mul, Rem, Shr}; use std::fs; use std::path::Path; use std::process::Command; -use std::time::{UNIX_EPOCH, SystemTime}; mod int128; mod spotify_id; @@ -22,14 +21,6 @@ pub fn rand_vec(rng: &mut G, size: usize) -> Vec { rng.gen_iter().take(size).collect() } -pub fn now_ms() -> i64 { - let dur = match SystemTime::now().duration_since(UNIX_EPOCH) { - Ok(dur) => dur, - Err(err) => err.duration(), - }; - (dur.as_secs() * 1000 + (dur.subsec_nanos() / 1000_000) as u64) as i64 -} - pub fn mkdir_existing(path: &Path) -> io::Result<()> { fs::create_dir(path).or_else(|err| { if err.kind() == io::ErrorKind::AlreadyExists { diff --git a/src/spirc.rs b/src/spirc.rs index 59b6b841..4e9e2991 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -6,7 +6,7 @@ use protobuf::{self, Message}; use core::config::ConnectConfig; use core::mercury::MercuryError; use core::session::Session; -use core::util::{now_ms, SpotifyId, SeqGenerator}; +use core::util::{SpotifyId, SeqGenerator}; use core::version; use protocol; @@ -18,6 +18,7 @@ use playback::player::Player; use std; use rand; use rand::Rng; +use std::time::{UNIX_EPOCH, SystemTime}; pub struct SpircTask { player: Player, @@ -53,6 +54,14 @@ pub struct Spirc { commands: mpsc::UnboundedSender, } +fn now_ms() -> i64 { + let dur = match SystemTime::now().duration_since(UNIX_EPOCH) { + Ok(dur) => dur, + Err(err) => err.duration(), + }; + (dur.as_secs() * 1000 + (dur.subsec_nanos() / 1000_000) as u64) as i64 +} + fn initial_state() -> State { protobuf_init!(protocol::spirc::State::new(), { repeat: false,