ocpi-tariffs 0.54.0

OCPI tariff calculations
Documentation
#![allow(
    clippy::arithmetic_side_effects,
    reason = "tests are allowed have arithmetic_side_effects"
)]

use chrono::{DateTime, TimeDelta, Utc};

use crate::test::ApproxEq;

impl ApproxEq for DateTime<Utc> {
    type Tolerance = TimeDelta;

    fn default_tolerance() -> Self::Tolerance {
        TimeDelta::default_tolerance()
    }

    fn approx_eq_tolerance(&self, other: &Self, tolerance: TimeDelta) -> bool {
        let diff = self.signed_duration_since(*other);
        diff.approx_eq_tolerance(&TimeDelta::zero(), tolerance)
    }
}