From 20dc006c88189b41c913f8d63782d1c4ade599ef Mon Sep 17 00:00:00 2001 From: Jenna Johnson Date: Thu, 28 Mar 2024 10:10:49 -0400 Subject: [PATCH] fixed timestamp --- src/internal/meta/file.rs | 3 +-- src/internal/storage/add.rs | 4 ++-- src/lib.rs | 22 +++++++++++----------- src/test_directory/test1.txt.dvsmeta | 5 +---- src/test_directory/test2.txt.dvsmeta | 5 +---- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/internal/meta/file.rs b/src/internal/meta/file.rs index aa4b4e7..67f39db 100644 --- a/src/internal/meta/file.rs +++ b/src/internal/meta/file.rs @@ -1,4 +1,3 @@ -use std::time::SystemTime; use std::path::PathBuf; use std::fs::File; use serde::{Deserialize, Serialize}; @@ -9,7 +8,7 @@ use std::fs; pub struct Metadata { pub file_hash: String, pub file_size: u64, - pub time_stamp: SystemTime, + pub time_stamp: String, pub message: String, pub saved_by: String } diff --git a/src/internal/storage/add.rs b/src/internal/storage/add.rs index 1a57bb5..f183db4 100644 --- a/src/internal/storage/add.rs +++ b/src/internal/storage/add.rs @@ -1,6 +1,6 @@ use std::os::unix::fs::PermissionsExt; use std::path::PathBuf; -use std::time::SystemTime; +use chrono::Utc; use file_owner::{Group, PathExt}; use std::fs::{self, Permissions}; @@ -99,7 +99,7 @@ pub fn add(local_path: &PathBuf, conf: &Config, message: &String) -> Result Robj { +pub fn run_init_cmd_R(storage_dir: &str, mode: i32, group: &str) -> Robj { // Get git root let git_repo = match repo::get_nearest_repo_dir(&PathBuf::from(".")) { @@ -24,15 +24,15 @@ pub fn run_init_cmd_R(storage_dir: &PathBuf, mode: &u32, group: &String) -> Robj }; // Initialize - match init::init(&git_repo, &storage_dir, &mode, &group) { - Ok(_) => { - // json - } - Err(e) => { - // json - return Robj::from(format!("Error initializing: {}", e)); - } - }; + // match init::init(&git_repo, &storage_dir, &mode, &group) { + // Ok(_) => { + // // json + // } + // Err(e) => { + // // json + // return Robj::from(format!("Error initializing: {}", e)); + // } + // }; let val: Result<()> = Ok(()); return val.into_robj(); diff --git a/src/test_directory/test1.txt.dvsmeta b/src/test_directory/test1.txt.dvsmeta index 1fe4631..b7e0075 100644 --- a/src/test_directory/test1.txt.dvsmeta +++ b/src/test_directory/test1.txt.dvsmeta @@ -1,10 +1,7 @@ { "file_hash": "71fe44583a6268b56139599c293aeb854e5c5a9908eca00105d81ad5e22b7bb6", "file_size": 445, - "time_stamp": { - "secs_since_epoch": 1711568741, - "nanos_since_epoch": 791273207 - }, + "time_stamp": "2024-03-28 10:10:22.930945979 -04:00", "message": "derived DA files", "saved_by": "jenna" } \ No newline at end of file diff --git a/src/test_directory/test2.txt.dvsmeta b/src/test_directory/test2.txt.dvsmeta index a63f699..b5438cb 100644 --- a/src/test_directory/test2.txt.dvsmeta +++ b/src/test_directory/test2.txt.dvsmeta @@ -1,10 +1,7 @@ { "file_hash": "89f8cf7f7cb020264179262691755f9d9b6b2246cb61d9b43b057aba4cbfa1d0", "file_size": 25, - "time_stamp": { - "secs_since_epoch": 1711568741, - "nanos_since_epoch": 791489089 - }, + "time_stamp": "2024-03-28 10:10:22.931225398 -04:00", "message": "derived DA files", "saved_by": "jenna" } \ No newline at end of file