Skip to content

Commit

Permalink
return non-zero modified timestamp when using webc v2
Browse files Browse the repository at this point in the history
  • Loading branch information
maminrayej committed May 8, 2024
1 parent 0d61573 commit 9f44d39
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/virtual-fs/src/webc_volume_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ impl VirtualFile for File {
}

fn last_modified(&self) -> u64 {
self.timestamps.map(|t| t.modified()).unwrap_or(0)
self.timestamps.map(|t| t.modified()).unwrap_or_else(|| {
// HACK: timestamps are not present in webc v2, so we have to return
// a stub modified time. previously we used to just return 0, but that
// proved to cause problems with programs that interpret the value 0.
// to circumvent this problem, we decided to return a non-zero value.
std::time::UNIX_EPOCH.elapsed().unwrap().as_secs()
})
}

fn created_time(&self) -> u64 {
Expand Down

0 comments on commit 9f44d39

Please sign in to comment.