summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-01-17 14:09:06 +0100
committerJustus Winter <justus@sequoia-pgp.org>2018-01-18 14:20:12 +0100
commit52987cace42c420c1a140844ba898c633fe7440c (patch)
tree79288ea78f98fc164e58eba10c5d225374cb18b8 /tool
parentc66b464a98e2751ea76adf7874884db62349508f (diff)
store: Use time::Timespec and fix stats.
- Use time::Timespec instead of std::time::SystemTime in the API. - Record timestamps of encryptions and verifications. - Adapt the tool.
Diffstat (limited to 'tool')
-rw-r--r--tool/Cargo.toml1
-rw-r--r--tool/src/main.rs12
2 files changed, 9 insertions, 4 deletions
diff --git a/tool/Cargo.toml b/tool/Cargo.toml
index f0118c1a..276f4c7e 100644
--- a/tool/Cargo.toml
+++ b/tool/Cargo.toml
@@ -10,6 +10,7 @@ sequoia-net = { path = "../net" }
sequoia-store = { path = "../store" }
clap = "2.27.1"
prettytable-rs = "0.6.7"
+time = "0.1.38"
[[bin]]
name = "sq"
diff --git a/tool/src/main.rs b/tool/src/main.rs
index 27f75530..ac79cb7d 100644
--- a/tool/src/main.rs
+++ b/tool/src/main.rs
@@ -3,6 +3,7 @@
extern crate clap;
#[macro_use]
extern crate prettytable;
+extern crate time;
use clap::{Arg, App, SubCommand, AppSettings};
use prettytable::Table;
@@ -413,8 +414,7 @@ fn real_main() -> Result<()> {
Cell::new(&item.fingerprint.to_string()),
Cell::new(&format!("{}", item.bindings)),
if let Some(ref t) = stats.updated {
- Cell::new(&sequoia_store::format_system_time(t)
- .expect("Failed to format timestamp"))
+ Cell::new(&format_time(t))
} else {
Cell::new("")
},
@@ -462,8 +462,7 @@ fn print_log(iter: LogIter) {
for entry in iter {
table.add_row(Row::new(vec![
- Cell::new(&sequoia_store::format_system_time(&entry.timestamp)
- .expect("Failed to format timestamp")),
+ Cell::new(&format_time(&entry.timestamp)),
Cell::new(&entry.slug),
Cell::new(&entry.short())]));
}
@@ -471,4 +470,9 @@ fn print_log(iter: LogIter) {
table.printstd();
}
+fn format_time(t: &time::Timespec) -> String {
+ time::strftime("%F %H:%M", &time::at(*t))
+ .unwrap() // Only parse errors can happen.
+}
+
fn main() { real_main().expect("An error occured"); }