Skip to content

Commit

Permalink
blockreader.rs NFC debug print mtime()
Browse files Browse the repository at this point in the history
For help with Issue #245
  • Loading branch information
jtmoon79 committed Mar 17, 2024
1 parent 772358d commit daded23
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions src/readers/blockreader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,12 +1416,18 @@ impl BlockReader {
// TODO: also handle when `self.file_metadata_modified` is zero
// (or a non-meaningful placeholder value).
pub fn mtime(&self) -> SystemTime {
def1ñ!();
match self.filetype {
FileType::File
| FileType::FixedStruct{..}
| FileType::Unknown
| FileType::Xz => self.file_metadata_modified,
| FileType::Xz => {
defñ!(
"{:?}: file_metadata_modified {:?}",
self.filetype, self.file_metadata_modified
);

self.file_metadata_modified
}
FileType::Gz => {
let mtime = self
.gz
Expand All @@ -1430,8 +1436,16 @@ impl BlockReader {
.mtime;
if mtime != 0 {
let seconds = mtime as u64;
seconds_to_systemtime(&seconds)
let st = seconds_to_systemtime(&seconds);
defñ!("{:?}: mtime {} -> {:?}", self.filetype, mtime, st);

st
} else {
defñ!(
"{:?}: file_metadata_modified {:?}",
self.filetype, self.file_metadata_modified
);

self.file_metadata_modified
}
}
Expand All @@ -1443,16 +1457,24 @@ impl BlockReader {
.mtime;
if mtime != 0 {
let seconds = mtime as u64;
seconds_to_systemtime(&seconds)
let st = seconds_to_systemtime(&seconds);
defñ!("{:?}: mtime {} -> {:?}", self.filetype, mtime, st);

st
} else {
defñ!(
"{:?}: file_metadata_modified {:?}",
self.filetype, self.file_metadata_modified
);

self.file_metadata_modified
}
}
// BlockReader not used for these filetypes
FileType::Evtx
| FileType::Journal
| FileType::TarGz
=> unimplemented!("Unsupported filetype {:?}", self.filetype),
=> unimplemented!("BlockReader does handle filetype {:?}", self.filetype),
// something is wrong if these are encountered
FileType::Unset => panic!("Unexpected Unset"),
FileType::Unparseable => panic!("Unexpected Unparseable"),
Expand Down

0 comments on commit daded23

Please sign in to comment.