Replace time with std::time

This commit is contained in:
Demur Rumed 2016-07-17 03:25:29 +00:00
parent a9ae5b5086
commit 674146f52a
3 changed files with 6 additions and 5 deletions

View file

@ -35,7 +35,6 @@ serde = "0.7"
serde_json = "0.7"
serde_macros = { version = "0.7", optional = true }
tempfile = "~2.1.3"
time = "~0.1.34"
url = "~0.5.0"
log = "0.3.5"
env_logger = "0.3.2"

View file

@ -28,7 +28,6 @@ extern crate rpassword;
extern crate rustc_serialize;
extern crate serde;
extern crate serde_json;
extern crate time;
extern crate tempfile;
extern crate url;

View file

@ -4,7 +4,7 @@ use std::io;
use std::ops::{Mul, Rem, Shr};
use std::fs;
use std::path::Path;
use time;
use std::time::{UNIX_EPOCH, SystemTime};
mod int128;
mod spotify_id;
@ -34,8 +34,11 @@ impl<T, E> IgnoreExt for Result<T, E> {
}
pub fn now_ms() -> i64 {
let ts = time::now_utc().to_timespec();
ts.sec * 1000 + ts.nsec as i64 / 1000000
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<()> {