like this

master
bel 2025-11-10 23:48:48 -07:00
parent 4067bd75fe
commit c9ee9d9a27
1 changed files with 19 additions and 3 deletions

View File

@ -158,12 +158,28 @@ impl File {
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct Delta(json_patch::Patch);
struct Delta{
ts: u64,
patch: json_patch::Patch,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct TaskAt {
struct TaskTs {
task: Task,
at: usize,
ts: u64,
}
impl Delta {
fn new(patch: json_patch::Patch, ts: u64) -> TaskTs {
Delta{
patch: patch,
ts: ts,
}
}
fn now(patch: json_patch::Patch) -> Delta {
Self::new(patch, std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs().try_into().unwrap())
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]