/// Convert Unix leap time to Unix time, from the list of leap seconds in a time zone
Convert Unix leap time to Unix time, from the list of leap seconds in a time zone
Convert Unix leap time to Unix time from the list of leap seconds in a time zone
fn unix_leap_time_to_unix_time(&self, unix_leap_time: i64) -> Result<i64, Error> {
        if unix_leap_time == i64::min_value() {
            return Err(Error::OutOfRange("out of range operation"));
        }
        let index = match self
            .leap_seconds
            .binary_search_by_key(&(unix_leap_time - 1), LeapSecond::unix_leap_time)
        {
            Ok(x) => x + 1,
            Err(x) => x,
        };
        let correction = if index > 0 { self.leap_seconds[index - 1].correction } else { 0 };
        match unix_leap_time.checked_sub(correction as i64) {
            Some(unix_time) => Ok(unix_time),
            None => Err(Error::OutOfRange("out of range operation")),
        }
    }
fn unix_leap_time_to_unix_time ( & self , unix_leap_time : i64 ) -> Result < i64 , Error > { if unix_leap_time == i64 :: min_value ( ) { return Err ( Error :: OutOfRange ( " " ) ) ; } let index = match self . leap_seconds . binary_search_by_key ( & ( unix_leap_time - 1 ) , LeapSecond :: unix_leap_time ) { Ok ( x ) => x + 1 , Err ( x ) => x , } ; let correction = if index > 0 { self . leap_seconds [ index - 1 ] . correction } else { 0 } ; match unix_leap_time . checked_sub ( correction as i64 ) { Some ( unix_time ) => Ok ( unix_time ) , None => Err ( Error :: OutOfRange ( " " ) ) , } }
Convert Unix leap time to Unix time, from the list of leap seconds in a time zone
Convert Unix leap time to Unix time from the list of leap seconds in a time zone
&self
unix_leap_time
i64