From 07ca6f6e668e087c1ddc94f1d1a7abde196607e1 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 4 Sep 2020 14:33:28 +0200 Subject: [PATCH] tools/systemd/tm_editor: remove reset_time from add_days and document it we never passed 'false' to it anyway so remove it (we can add it again if we should ever need it) also remove the adding of wday (gets normalized anyway) Signed-off-by: Dominik Csapak --- src/tools/systemd/time.rs | 6 +++--- src/tools/systemd/tm_editor.rs | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/tools/systemd/time.rs b/src/tools/systemd/time.rs index 2e99e289..c8cc8468 100644 --- a/src/tools/systemd/time.rs +++ b/src/tools/systemd/time.rs @@ -181,10 +181,10 @@ pub fn compute_next_event( .find(|d| event.days.contains(WeekDays::from_bits(1< Result<(), Error> { + /// increases the day by 'days' and resets all smaller fields to their minimum + pub fn add_days(&mut self, days: libc::c_int) -> Result<(), Error> { if days == 0 { return Ok(()); } - if reset_time { - self.t.tm_hour = 0; - self.t.tm_min = 0; - self.t.tm_sec = 0; - } + self.t.tm_hour = 0; + self.t.tm_min = 0; + self.t.tm_sec = 0; self.t.tm_mday += days; - self.t.tm_wday += days; self.normalize_time() }