summaryrefslogtreecommitdiff
path: root/lib/domain/libimagdiary/src/diary.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-07-27 20:10:59 +0200
committerGitHub <noreply@github.com>2018-07-27 20:10:59 +0200
commitacdc1e84bc3082579d844947a978485152b4f6e6 (patch)
treec41b1f1722e9e83207f6bcf53131f158260b6824 /lib/domain/libimagdiary/src/diary.rs
parent2a62b6dffb9f82a464cc7d9e21a488aee04197ca (diff)
parentb896bc2657a7f39283f4b82b8a4a565e108f2fdd (diff)
downloadimag-acdc1e84bc3082579d844947a978485152b4f6e6.zip
imag-acdc1e84bc3082579d844947a978485152b4f6e6.tar.gz
Merge pull request #1495 from matthiasbeyer/imag-diary/fix-missing-header
Imag diary/fix missing header
Diffstat (limited to 'lib/domain/libimagdiary/src/diary.rs')
-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(),