summaryrefslogtreecommitdiffstats
path: root/src/utils.rs
blob: 5a18948309719adf1a502a3c62b054afa7e15da1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
use chrono::prelude::*;
use std::io::{stdout, Write};

pub fn dump<T: ToString>(text: T, newlines: usize) {
    print!("{}{}", text.to_string(), "\n".repeat(newlines));
    let _ = stdout().flush();
}

pub fn now() -> String {
    let now = Local::now();
    now.to_rfc3339_opts(SecondsFormat::Secs, false)
}