mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-10 11:44:22 +01:00
add time querying to io trait
This commit is contained in:
@@ -110,6 +110,10 @@ impl IO for DarwinIO {
|
||||
getrandom::getrandom(&mut buf).unwrap();
|
||||
i64::from_ne_bytes(buf)
|
||||
}
|
||||
|
||||
fn get_current_time(&self) -> String {
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()
|
||||
}
|
||||
}
|
||||
|
||||
enum CompletionCallback {
|
||||
|
||||
@@ -30,6 +30,10 @@ impl IO for GenericIO {
|
||||
getrandom::getrandom(&mut buf).unwrap();
|
||||
i64::from_ne_bytes(buf)
|
||||
}
|
||||
|
||||
fn get_current_time(&self) -> String {
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct GenericFile {
|
||||
|
||||
@@ -111,6 +111,10 @@ impl IO for LinuxIO {
|
||||
getrandom::getrandom(&mut buf).unwrap();
|
||||
i64::from_ne_bytes(buf)
|
||||
}
|
||||
|
||||
fn get_current_time(&self) -> String {
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LinuxFile {
|
||||
|
||||
@@ -22,6 +22,8 @@ pub trait IO {
|
||||
fn run_once(&self) -> Result<()>;
|
||||
|
||||
fn generate_random_number(&self) -> i64;
|
||||
|
||||
fn get_current_time(&self) -> String;
|
||||
}
|
||||
|
||||
pub type Complete = dyn Fn(Rc<RefCell<Buffer>>);
|
||||
|
||||
@@ -30,6 +30,10 @@ impl IO for WindowsIO {
|
||||
getrandom::getrandom(&mut buf).unwrap();
|
||||
i64::from_ne_bytes(buf)
|
||||
}
|
||||
|
||||
fn get_current_time(&self) -> String {
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WindowsFile {
|
||||
|
||||
Reference in New Issue
Block a user