summaryrefslogtreecommitdiff
path: root/lib/domain/libimagdiary/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/domain/libimagdiary/src')
-rw-r--r--lib/domain/libimagdiary/src/diary.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/domain/libimagdiary/src/diary.rs b/lib/domain/libimagdiary/src/diary.rs
index ea4b249..779c7d5 100644
--- a/lib/domain/libimagdiary/src/diary.rs
+++ b/lib/domain/libimagdiary/src/diary.rs
@@ -47,6 +47,8 @@ pub trait Diary {
// create or get a new entry for now
fn new_entry_now(&self, diary_name: &str) -> Result<FileLockEntry>;
+ fn new_entry_at(&self, diary_name: &str, ndt: &NaiveDateTime) -> Result<FileLockEntry>;
+
// Get an iterator for iterating over all entries of a Diary
fn entries(&self, diary_name: &str) -> Result<DiaryEntryIterator>;
@@ -73,6 +75,10 @@ impl Diary for Store {
fn new_entry_now(&self, diary_name: &str) -> Result<FileLockEntry> {
let dt = Local::now();
let ndt = dt.naive_local();
+ self.new_entry_at(diary_name, &ndt)
+ }
+
+ fn new_entry_at(&self, diary_name: &str, ndt: &NaiveDateTime) -> Result<FileLockEntry> {
let id = DiaryId::new(String::from(diary_name),
ndt.year(),
ndt.month(),