Skip to content

Commit

Permalink
fixed timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
jenna-a2ai committed Mar 28, 2024
1 parent ca07b85 commit 20dc006
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/internal/meta/file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::time::SystemTime;
use std::path::PathBuf;
use std::fs::File;
use serde::{Deserialize, Serialize};
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions src/internal/storage/add.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn add(local_path: &PathBuf, conf: &Config, message: &String) -> Result<Stri
let metadata = file::Metadata{
file_hash: file_hash.clone(),
file_size,
time_stamp: SystemTime::now(),
time_stamp: chrono::offset::Local::now().to_string(),
message: message.clone(),
saved_by: owner_name
};
Expand Down
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use extendr_api::prelude::*;
use extendr_api::{prelude::*, robj};
use extendr_api::robj::{Robj, IntoRobj};
use std::path::PathBuf;

Expand All @@ -9,7 +9,7 @@ use crate::internal::storage::init;
// initiate storage directory
// @export
#[extendr]
pub fn run_init_cmd_R(storage_dir: &PathBuf, mode: &u32, group: &String) -> 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(".")) {
Expand All @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions src/test_directory/test1.txt.dvsmeta
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 1 addition & 4 deletions src/test_directory/test2.txt.dvsmeta
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 20dc006

Please sign in to comment.