diff --git a/src/bundledb/mod.rs b/src/bundledb/mod.rs index ab8c687..9e99475 100644 --- a/src/bundledb/mod.rs +++ b/src/bundledb/mod.rs @@ -97,7 +97,8 @@ pub struct BundleInfo { pub raw_size: usize, pub encoded_size: usize, pub chunk_count: usize, - pub chunk_list_size: usize + pub chunk_list_size: usize, + pub timestamp: i64 } serde_impl!(BundleInfo(u64?) { id: BundleId => 0, @@ -108,7 +109,8 @@ serde_impl!(BundleInfo(u64?) { raw_size: usize => 6, encoded_size: usize => 7, chunk_count: usize => 8, - chunk_list_size: usize => 9 + chunk_list_size: usize => 9, + timestamp: i64 => 10 }); impl Default for BundleInfo { @@ -122,7 +124,8 @@ impl Default for BundleInfo { encoded_size: 0, chunk_count: 0, mode: BundleMode::Data, - chunk_list_size: 0 + chunk_list_size: 0, + timestamp: 0 } } } diff --git a/src/bundledb/writer.rs b/src/bundledb/writer.rs index 2421089..728c3c5 100644 --- a/src/bundledb/writer.rs +++ b/src/bundledb/writer.rs @@ -6,6 +6,8 @@ use std::fs::File; use std::io::{self, Write, BufWriter}; use std::sync::{Arc, Mutex}; +use chrono::prelude::*; + quick_error!{ #[derive(Debug)] @@ -114,7 +116,8 @@ impl BundleWriter { id: id.clone(), raw_size: self.raw_size, encoded_size: encoded_size, - chunk_list_size: chunk_data.len() + chunk_list_size: chunk_data.len(), + timestamp: Local::now().timestamp() }; let mut info_data = try!(msgpack::encode(&info).context(&path as &Path)); if let Some(ref encryption) = self.encryption { diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 38cda24..d8bb5a1 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -213,6 +213,7 @@ fn print_bundle(bundle: &StoredBundle) { println!("Bundle {}", bundle.info.id); println!(" - Mode: {:?}", bundle.info.mode); println!(" - Path: {:?}", bundle.path); + println!(" - Date: {}", Local.timestamp(bundle.info.timestamp, 0).to_rfc2822()); println!(" - Hash method: {:?}", bundle.info.hash_method); let encryption = if let Some((_, ref key)) = bundle.info.encryption { to_hex(key)