fn parse()

in mini-sntp/src/lib.rs [250:300]


    fn parse(buf: [u8; 48], sntp_epoch: chrono::DateTime<chrono::Utc>) -> Self {
        let leap_indicator = (buf[0] & 0b11_000_000) >> 6;
        let version_number = (buf[0] & 0b00_111_000) >> 3;
        let mode = buf[0] & 0b00_000_111;
        let stratum = buf[1];
        let poll_interval = buf[2];
        let precision = buf[3];
        let root_delay = u32::from_be_bytes([buf[4], buf[5], buf[6], buf[7]]);
        let root_dispersion = u32::from_be_bytes([buf[8], buf[9], buf[10], buf[11]]);
        let reference_identifier = u32::from_be_bytes([buf[12], buf[13], buf[14], buf[15]]);
        let reference_timestamp = deserialize_timestamp(
            [
                buf[16], buf[17], buf[18], buf[19], buf[20], buf[21], buf[22], buf[23],
            ],
            sntp_epoch,
        );
        let originate_timestamp = deserialize_timestamp(
            [
                buf[24], buf[25], buf[26], buf[27], buf[28], buf[29], buf[30], buf[31],
            ],
            sntp_epoch,
        );
        let receive_timestamp = deserialize_timestamp(
            [
                buf[32], buf[33], buf[34], buf[35], buf[36], buf[37], buf[38], buf[39],
            ],
            sntp_epoch,
        );
        let transmit_timestamp = deserialize_timestamp(
            [
                buf[40], buf[41], buf[42], buf[43], buf[44], buf[45], buf[46], buf[47],
            ],
            sntp_epoch,
        );

        Packet {
            leap_indicator,
            version_number,
            mode,
            stratum,
            poll_interval,
            precision,
            root_delay,
            root_dispersion,
            reference_identifier,
            reference_timestamp,
            originate_timestamp,
            receive_timestamp,
            transmit_timestamp,
        }
    }