Rearrange imports
This commit is contained in:
parent
5543f0a6b6
commit
d33aa89ff6
|
@ -1,7 +1,6 @@
|
|||
use crate::queries::*;
|
||||
use sqlite::*;
|
||||
use std::fs::{self, OpenOptions};
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub struct DatasetMetadata {
|
||||
|
@ -21,7 +20,7 @@ pub struct DatasetMetadata {
|
|||
}
|
||||
|
||||
/// Return the path to the datasets file.
|
||||
fn datasets_path(config_dir: &Path) -> io::Result<PathBuf> {
|
||||
fn datasets_path(config_dir: &Path) -> std::io::Result<PathBuf> {
|
||||
let mut path = config_dir.to_owned();
|
||||
path.push("startrnr");
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
use clap::{Parser, Subcommand};
|
||||
use sqlite::*;
|
||||
use std::path::PathBuf;
|
||||
use std::time::SystemTime;
|
||||
use time_format::strftime_utc;
|
||||
|
||||
mod queries;
|
||||
|
@ -172,10 +171,6 @@ fn dataset_list(connection: &Connection) {
|
|||
println!("(Global)");
|
||||
}
|
||||
|
||||
let current_time = SystemTime::now()
|
||||
.duration_since(SystemTime::UNIX_EPOCH)
|
||||
.unwrap_or_else(|_| error("System time is before the Unix epoch (1970)!", 2))
|
||||
.as_secs();
|
||||
if metadata.last_sync.0 == 1 {
|
||||
print!("\x1b[1m\x1b[91mUnsynced\x1b[0m");
|
||||
} else {
|
||||
|
@ -184,7 +179,7 @@ fn dataset_list(connection: &Connection) {
|
|||
strftime_utc("%b %e, %Y %I:%M %p", metadata.last_sync.0 as i64).unwrap()
|
||||
);
|
||||
}
|
||||
if current_time - metadata.last_sync.0 > SECS_IN_WEEK {
|
||||
if current_time().0 - metadata.last_sync.0 > SECS_IN_WEEK {
|
||||
if name == "default" {
|
||||
print!(" - \x1b[33mRun 'startrnr sync' to update!\x1b[0m");
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use sqlite::*;
|
||||
use std::io::{self, Write};
|
||||
use std::process::exit;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use crate::database::*;
|
||||
use crate::queries::{PlayerData, PlayerId, Timestamp};
|
||||
|
@ -21,6 +20,8 @@ pub fn issue(msg: &str, code: i32) -> ! {
|
|||
}
|
||||
|
||||
pub fn current_time() -> Timestamp {
|
||||
use std::time::SystemTime;
|
||||
|
||||
Timestamp(
|
||||
SystemTime::now()
|
||||
.duration_since(SystemTime::UNIX_EPOCH)
|
||||
|
|
Loading…
Reference in a new issue