subscription: expose the next_due_date as an i64

internally `SubscriptionInfo` already uses the `parse_next_due` helper
to parse the next due date to an epoch. this exposes a function that
allows us to use the epoch outside of this crate too. for example, a
user of pom may have multiple subscription for the same system. in
that case we want to apply the one with the due date that is furthest
in the future.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
This commit is contained in:
Stefan Sterz 2023-11-09 16:33:59 +01:00 committed by Fabian Grünbichler
parent 81cdba6181
commit ee7a908ebc

View File

@ -286,6 +286,13 @@ impl SubscriptionInfo {
.ok_or_else(|| format_err!("no product key set"))
.map(|key| key[..3].parse::<ProductType>())?
}
pub fn get_next_due_date(&self) -> Result<i64, Error> {
self.nextduedate
.as_ref()
.ok_or_else(|| format_err!("no next due date set"))
.map(|e| parse_next_due(e))?
}
}
/// Shortcut for md5 sums.