tools/systemd/time: fix selection for multiple options

if we give multiple options/ranges for a value, e.g.
2,4,8
we always choose the biggest, instead of the smallest that is next

this happens because in DateTimeValue::find_next(value)
'next' can be set multiple times and we set it when the new
value was *bigger* than the last found 'next' value, when in reality
we have to choose the *smallest* next we can find

reverse the comparison operator to fix this

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-09-04 14:33:30 +02:00 committed by Dietmar Maurer
parent ce7ab28cfa
commit d5cf8f606c
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ impl DateTimeValue {
let mut next: Option<u32> = None; let mut next: Option<u32> = None;
let mut set_next = |v: u32| { let mut set_next = |v: u32| {
if let Some(n) = next { if let Some(n) = next {
if v > n { next = Some(v); } if v < n { next = Some(v); }
} else { } else {
next = Some(v); next = Some(v);
} }