(
&self,
pos: usize,
precision: u32,
)
| 258 | } |
| 259 | |
| 260 | pub(crate) fn get_timestamp_raw( |
| 261 | &self, |
| 262 | pos: usize, |
| 263 | precision: u32, |
| 264 | ) -> crate::Result<(i64, i32)> { |
| 265 | if precision <= 3 { |
| 266 | Ok((self.get_long(pos)?, 0)) |
| 267 | } else { |
| 268 | let field_off = self.field_offset(pos); |
| 269 | let offset_and_nano = self.read_i64_at(field_off)? as u64; |
| 270 | let offset = (offset_and_nano >> 32) as usize; |
| 271 | let nano_of_milli = offset_and_nano as i32; |
| 272 | |
| 273 | if offset + 8 > self.data.len() { |
| 274 | return Err(crate::Error::UnexpectedError { |
| 275 | message: format!( |
| 276 | "BinaryRow: non-compact Timestamp at pos {pos}: offset {offset} + 8 exceeds data length {}", |
| 277 | self.data.len() |
| 278 | ), |
| 279 | source: None, |
| 280 | }); |
| 281 | } |
| 282 | let millis = i64::from_le_bytes(self.read_slice::<8>(offset)?); |
| 283 | Ok((millis, nano_of_milli)) |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | pub fn hash_code(&self) -> i32 { |
| 288 | hash_by_words(&self.data) |
no test coverage detected